@Test public void applyDefaultsToBaseType() { TextNode formatNode = TextNode.valueOf("unknown-format"); JType baseType = new JCodeModel().ref(Long.class); JType result = rule.apply("fooBar", formatNode, null, baseType, null); assertThat(result, equalTo(baseType)); }
@Override public JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema) { Class<?> type = getType(node.asText()); if (type != null) { JType jtype = baseType.owner().ref(type); if (ruleFactory.getGenerationConfig().isUsePrimitives()) { jtype = jtype.unboxify(); } return jtype; } else { return baseType; } }
FormatRule implements Rule<JType, JType> { @Override public JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema) { Class<?> type = getType(node.asText()); if (type != null) { JType jtype = baseType.owner().ref(type); if (ruleFactory.getGenerationConfig().isUsePrimitives()) { jtype = jtype.unboxify(); } return jtype; } else { return baseType; } } }
FormatRule implements Rule<JType, JType> { @Override public JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema) { Class<?> type = getType(node.asText()); if (type != null) { JType jtype = baseType.owner().ref(type); if (ruleFactory.getGenerationConfig().isUsePrimitives()) { jtype = jtype.unboxify(); } return jtype; } else { return baseType; } } protected  FormatRule(RuleFactory ruleFactory); }
FormatRule implements Rule<JType, JType> { @Override public JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema) { Class<?> type = getType(node.asText()); if (type != null) { JType jtype = baseType.owner().ref(type); if (ruleFactory.getGenerationConfig().isUsePrimitives()) { jtype = jtype.unboxify(); } return jtype; } else { return baseType; } } protected  FormatRule(RuleFactory ruleFactory); @Override JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema); }
FormatRule implements Rule<JType, JType> { @Override public JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema) { Class<?> type = getType(node.asText()); if (type != null) { JType jtype = baseType.owner().ref(type); if (ruleFactory.getGenerationConfig().isUsePrimitives()) { jtype = jtype.unboxify(); } return jtype; } else { return baseType; } } protected  FormatRule(RuleFactory ruleFactory); @Override JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema); static String ISO_8601_DATE_FORMAT; static String ISO_8601_TIME_FORMAT; static String ISO_8601_DATETIME_FORMAT; }