@Test public void jsrDisable() { when(config.isIncludeJsr303Annotations()).thenReturn(false); JFieldVar result = rule.apply("node", node, null, fieldVar, null); assertSame(fieldVar, result); verify(fieldVar, never()).annotate(Pattern.class); verify(annotation, never()).param(anyString(), anyString()); }
@Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Pattern.class); annotation.param("regexp", node.asText()); } return field; }
PatternRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Pattern.class); annotation.param("regexp", node.asText()); } return field; } }
PatternRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Pattern.class); annotation.param("regexp", node.asText()); } return field; } PatternRule(RuleFactory ruleFactory); }
PatternRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Pattern.class); annotation.param("regexp", node.asText()); } return field; } PatternRule(RuleFactory ruleFactory); @Override JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema); }
PatternRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Pattern.class); annotation.param("regexp", node.asText()); } return field; } PatternRule(RuleFactory ruleFactory); @Override JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema);  }