@Test public void testOptionalFields() { schema.clearFields(); BooleanSchema required = new BooleanSchema(); AppInfo info = new AppInfo(null); info.put("required", "true"); required.addAnnotation(info); schema.addField("optionalField", booleanSchema); schema.addField("requiredField", required); Map<String, Object> complexEntity = new HashMap<String, Object>(); complexEntity.put("requiredField", Boolean.TRUE); assertTrue(schema.validate(complexEntity)); complexEntity.put("optionalField", Boolean.FALSE); assertTrue(schema.validate(complexEntity)); complexEntity.remove("requiredField"); assertFalse(schema.validate("requiredField")); }
@Override protected boolean validate(String validateFieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { return this.validate(validateFieldName, entity, errors, repo, true); }
ComplexSchema extends NeutralSchema { @Override protected boolean validate(String validateFieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { return this.validate(validateFieldName, entity, errors, repo, true); } }
ComplexSchema extends NeutralSchema { @Override protected boolean validate(String validateFieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { return this.validate(validateFieldName, entity, errors, repo, true); } ComplexSchema();  ComplexSchema(String xsdType); }
ComplexSchema extends NeutralSchema { @Override protected boolean validate(String validateFieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { return this.validate(validateFieldName, entity, errors, repo, true); } ComplexSchema();  ComplexSchema(String xsdType); @Override boolean isPrimitive(); @Override NeutralSchemaType getSchemaType(); @Override boolean validatePresent(Object entity, List<ValidationError> errors, Repository<Entity> repo); @Override boolean isSimple(); }
ComplexSchema extends NeutralSchema { @Override protected boolean validate(String validateFieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { return this.validate(validateFieldName, entity, errors, repo, true); } ComplexSchema();  ComplexSchema(String xsdType); @Override boolean isPrimitive(); @Override NeutralSchemaType getSchemaType(); @Override boolean validatePresent(Object entity, List<ValidationError> errors, Repository<Entity> repo); @Override boolean isSimple();  }