public class Test { public static void main(String[] args) { List<Validator> v = new ArrayList<Validator>(); v.add(new StringValidator()); v.add(new IntegerValidator()); for (Validator validator : v) { validator.validate(); } } }
public class Main { @Autowired private Validateable validateable; @Autowired private Stringable stringable; public void main() { final List<String> validationList = validateable.getValidationList(); final List<String> stringList = stringable.getStringList(); StringValidator stringValidator = new StringValidator(stringList, validationList); stringValidator.validate(); final List<String> validatedList = stringValidator.getValidatedList(); } public static void main(String[] args) { Container container = new ...; container.get(Main.class).main(); } }
throws ValidationException { if (value == null) { if (_required && !isNillable()) { String err = "this is a required field and cannot be null."; throw new ValidationException(err); if (hasPattern()) { super.validate(value, context); normalize(value);
typeValidator = new org.exolab.castor.xml.validators.StringValidator(); fieldValidator.setValidator(typeValidator); typeValidator.setWhiteSpace("preserve");
/** * Validates the given Object. * * @param object * the Object to validate * @throws ValidationException if the object fails validation. */ public void validate(final Object object) throws ValidationException { validate(object, (ValidationContext) null); } // -- validate
/** * Only used for backward compatibility for object model generated with an * old version of Castor. * * @param fixedValue * the fixed value that all Strings must match * * @deprecated since 0.9.4_beta */ public void setFixedValue(final String fixedValue) { setFixed(fixedValue); }
typeValidator = new org.exolab.castor.xml.validators.StringValidator(); fieldValidator.setValidator(typeValidator); typeValidator.setWhiteSpace("preserve");
/** * Validates the given Object. * * @param value the string to validate * @param context the ValidationContext * @throws ValidationException if the object fails validation. */ public void validate(final String value, final ValidationContext context) throws ValidationException { super.validate(value, context); } // -- validate
/** * Only used for backward compatibility for object model generated with an old version of Castor. * * @param fixedValue the fixed value that all Strings must match * * @deprecated since 0.9.4_beta */ public void setFixedValue(final String fixedValue) { setFixed(fixedValue); }
typeValidator = new org.exolab.castor.xml.validators.StringValidator(); fieldValidator.setValidator(typeValidator); typeValidator.setWhiteSpace("preserve");
ArrayList<Validator> validators = new ArrayList<Validator>(); validators.add(new StringValidator()); validators.add(new IntegerValidator());
/** * Validates the given Object. * * @param object the Object to validate * @throws ValidationException if the object fails validation. */ public void validate(final Object object) throws ValidationException { validate(object, (ValidationContext) null); } // -- validate
throws ValidationException { if (value == null) { if (_required && !isNillable()) { String err = "this is a required field and cannot be null."; throw new ValidationException(err); if (hasPattern()) { super.validate(value, context); normalize(value);
typeValidator = new org.exolab.castor.xml.validators.StringValidator(); fieldValidator.setValidator(typeValidator); typeValidator.setWhiteSpace("preserve");
ArrayList<Validator> validators = new ArrayList<Validator>(); validators.add(new StringValidator()); validators.add(new IntegerValidator());
/** * Validates the given Object. * * @param value * the string to validate * @param context * the ValidationContext * @throws ValidationException if the object fails validation. */ public void validate(final String value, final ValidationContext context) throws ValidationException { super.validate(value, context); } //-- validate
typeValidator = new org.exolab.castor.xml.validators.StringValidator(); fieldValidator.setValidator(typeValidator); typeValidator.setWhiteSpace("preserve");
List<Validator> validators = new ArrayList<Validator>(); validators.add(new StringValidator()); validators.add(new IntegerValidator());
/** * Validates the given Object. * * @param object the Object to validate * @param context the ValidationContext * @throws ValidationException if the object fails validation. */ public void validate(final Object object, final ValidationContext context) throws ValidationException { if (object == null) { if (_required) { String err = "this is a required field and cannot be null."; throw new ValidationException(err); } return; } validate(object.toString(), context); } // -- validate
typeValidator = new org.exolab.castor.xml.validators.StringValidator(); fieldValidator.setValidator(typeValidator); typeValidator.setWhiteSpace("preserve");