code: public org.valkyriercp.binding.validation.ValidationResults validate(Object object, String propertyName) {
  		// Forms can have different types of objects, so when type of object
  		// changes, messages that are already listed on the previous type must
  		// be removed. If evaluating the whole object (propertyName == null)
  		// 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);
  							}
  						}
  						else if (validationRule.isDependentOn(propertyName)) {
  							checkRule(validationRule);
  						}
  					}
  				}
  			}
  			else {
  				logger.debug("No rules source has been configured; "
  						+ "please set a valid reference to enable rules-based validation.");
  			}
  		}
  		return results;
  	}
docs: {@inheritDoc}