@Size @Pattern.List({ @Pattern(regexp = "....."), @Pattern(regexp = "bar") }) @Constraint(validatedBy = FrenchZipcodeListContainerConstraintValidator.class) @Documented
Pattern.List a = (Pattern.List) helper.getAnnotation(element, Pattern.List.class); PatternListFacet facet = new PatternListFacet(new ArrayList<PatternFacet>()); for (Pattern pat : a.value()) { PatternFacet pf = new PatternFacet(pat.regexp(), pat.flags()); facet.addPattern(pf);
Pattern.List a = (Pattern.List) helper.getAnnotation(element, Pattern.List.class); PatternListFacet facet = new PatternListFacet(new ArrayList<PatternFacet>()); for (Pattern pat : a.value()) { PatternFacet pf = new PatternFacet(pat.regexp(), pat.flags()); facet.addPattern(pf);
/** * @author Guillaume Smet */ public class FrenchAddressMixDirectAnnotationAndListContainer extends Address { @Override @FrenchZipcodeMixDirectAnnotationAndListContainer public String getZipCode() { return super.getZipCode(); } @Pattern(regexp = ".....") @Pattern.List({ @Pattern(regexp = "bar") }) @Constraint(validatedBy = FrenchZipcodeMixDirectAnnotationAndListContainerConstraintValidator.class) @Documented @Target({ METHOD, FIELD, TYPE }) @Retention(RUNTIME) public @interface FrenchZipcodeMixDirectAnnotationAndListContainer { String message() default "Wrong zipcode"; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default {}; @OverridesAttribute(constraint = Pattern.class, name = "regexp", constraintIndex = 1) String regex() default "\\d*"; } }
@NotNull(message = VALIDATION_MESSAGE_MAC_ADDRESS_NOT_NULL, groups = { UpdateVmNic.class }) @Pattern.List({ @Pattern(regexp = "(^$)|(" + MacAddressValidationPatterns.VALID_MAC_ADDRESS_FORMAT + ")", message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, groups = { CreateEntity.class }), @Pattern(regexp = "(^$)|(" + MacAddressValidationPatterns.NON_MULTICAST_MAC_ADDRESS_FORMAT + ")", message = VALIDATION_VM_NETWORK_MAC_ADDRESS_MULTICAST, groups = { CreateEntity.class }), @Pattern(regexp = MacAddressValidationPatterns.VALID_MAC_ADDRESS_FORMAT, message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, groups = { UpdateEntity.class }), @Pattern(regexp = MacAddressValidationPatterns.NON_MULTICAST_MAC_ADDRESS_FORMAT, message = VALIDATION_VM_NETWORK_MAC_ADDRESS_MULTICAST, groups = { UpdateEntity.class }), @Pattern(regexp = MacAddressValidationPatterns.NON_NULLABLE_MAC_ADDRESS_FORMAT, message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, groups = { CreateEntity.class, UpdateEntity.class }) }) @Override public String getMacAddress() { return super.getMacAddress(); }