// also clear results.
if ((propertyName == null) || ((objectClass != null) && objectClass != object.getClass())) {
clearMessages();
}
objectClass = object.getClass();
Rules rules = null;
if (object instanceof PropertyConstraintProvider) {
PropertyConstraintProvider propertyConstraintProvider = (PropertyConstraintProvider) object;
if (propertyName != null) {
PropertyConstraint validationRule = propertyConstraintProvider.getPropertyConstraint(propertyName);
checkRule(validationRule);
}
else {
for (Iterator fieldNamesIter = formModel.getFieldNames().iterator(); fieldNamesIter.hasNext();) {
PropertyConstraint validationRule = propertyConstraintProvider
.getPropertyConstraint((String) fieldNamesIter.next());
checkRule(validationRule);
}
}
}
else {
if (getRulesSource() != null) {
rules = getRulesSource().getRules(objectClass, getRulesContextId());
if (rules != null) {
for (Iterator i = rules.iterator(); i.hasNext();) {
PropertyConstraint validationRule = (PropertyConstraint) i.next();
if (propertyName == null) {
if (formModel.hasValueModel(validationRule.getPropertyName())) {
checkRule(validationRule);
}