if (constrainedProperties.remove(p.getName()) != null) {
LOG.warn("Derived properties may not be constrained. Property [" + p.getName() + "] of domain class " + theClass.getName() + " will not be checked during validation.");
}
} else {
final String propertyName = p.getName();
Constrained cp = constrainedProperties.get(propertyName);
if (cp == null) {
ConstrainedProperty constrainedProperty = new ConstrainedProperty(p.getDomainClass().getClazz(), propertyName, p.getType());
cp = constrainedProperty;
constrainedProperty.setOrder(constrainedProperties.size() + 1);
constrainedProperties.put(propertyName, cp);
}
// Make sure all fields are required by default, unless
// specified otherwise by the constraints
// If the field is a Java entity annotated with @Entity skip this
applyDefaultConstraints(propertyName, p, cp, defaultConstraints);
}
}
}
}
if (properties == null || properties.length == 0) {
final Set<Entry<String, Constrained>> entrySet = constrainedProperties.entrySet();
for (Entry<String, Constrained> entry : entrySet) {
final Constrained constrainedProperty = entry.getValue();
if (!constrainedProperty.hasAppliedConstraint(ConstrainedProperty.NULLABLE_CONSTRAINT)) {
applyDefaultNullableConstraint(constrainedProperty, defaultNullable);
}
}
}