public Constraint buildConstraint(ConstraintConfiguration config) { if (NotNullConstraint.NAME.equals(config.getConstraintName())) { return new NotNullConstraint(); } else if (IntegerConstraint.NAME.equals(config.getConstraintName())) { return new IntegerConstraint(); } else if (RangeConstraint.NAME.equals(config.getConstraintName())) { return new RangeConstraint(); } else if (NotMatchesConstraint.NAME.equals(config.getConstraintName())) { return new NotMatchesConstraint(); }else if (MatchesConstraint.NAME.equals(config.getConstraintName())) { return new MatchesConstraint(); }else if (InvalidFieldConstraint.NAME.equals(config.getConstraintName())) { return new InvalidFieldConstraint(); }else if (MandatoryFieldConstraint.NAME.equals(config.getConstraintName())) { return new MandatoryFieldConstraint(); } else { throw new IllegalArgumentException("Constraint unknown: " + config.getConstraintName()); } }
public Constraint buildConstraint(ConstraintConfiguration config) { if (NotNullConstraint.NAME.equals(config.getConstraintName())) { return new NotNullConstraint(); } else if (IntegerConstraint.NAME.equals(config.getConstraintName())) { return new IntegerConstraint(); } else if (RangeConstraint.NAME.equals(config.getConstraintName())) { return new RangeConstraint(); } else if (NotMatchesConstraint.NAME.equals(config.getConstraintName())) { return new NotMatchesConstraint(); }else if (MatchesConstraint.NAME.equals(config.getConstraintName())) { return new MatchesConstraint(); }else if (InvalidFieldConstraint.NAME.equals(config.getConstraintName())) { return new InvalidFieldConstraint(); }else if (MandatoryFieldConstraint.NAME.equals(config.getConstraintName())) { return new MandatoryFieldConstraint(); } else { throw new IllegalArgumentException("Constraint unknown: " + config.getConstraintName()); } }
@Before public void setup() { conf = new SimpleConstraintConfigurationImpl(); conf.setFactType("Person"); conf.setFieldName("name"); cons = new NotNullConstraint(); }