@Override
 @SuppressWarnings("unchecked")
 public Collection<String> validateGraph(
     FacesContext context, Object value, Set<String> profiles) {
   if (null == context) {
     throw new FacesException(INPUT_PARAMETERS_IS_NOT_CORRECT);
   }
   Collection<String> validationMessages = null;
   if (null != value) {
     ClassValidator<Object> validator =
         (ClassValidator<Object>) getValidator(context, value.getClass());
     if (validator.hasValidationRules()) {
       InvalidValue[] invalidValues = validator.getInvalidValues(value);
       if (null != invalidValues && invalidValues.length > 0) {
         validationMessages = new ArrayList<String>(invalidValues.length);
         for (int i = 0; i < invalidValues.length; i++) {
           InvalidValue invalidValue = invalidValues[i];
           validationMessages.add(invalidValue.getMessage());
         }
       }
     }
     if (null != parent) {
       Collection<String> parentMessages = parent.validateGraph(context, value, profiles);
       if (null != validationMessages) {
         if (null != parentMessages) {
           validationMessages.addAll(parentMessages);
         }
       } else {
         validationMessages = parentMessages;
       }
     }
   }
   return validationMessages;
 }
 @SuppressWarnings("unchecked")
 protected void validateModelObject() {
   final T o = getPersistentObjectModel().getObject();
   ClassValidator<T> v =
       validator == null ? v = new ClassValidator(Hibernate.getClass(o)) : validator;
   for (final InvalidValue iv : v.getInvalidValues(o)) {
     error(iv.getPropertyName() + " " + iv.getMessage());
   }
 }
  @SuppressWarnings("unchecked")
  public List<Message> validate(Object object) {
    List<Message> errors = new ArrayList<Message>();
    ClassValidator<Object> validator =
        (ClassValidator<Object>) locator.getValidator(object.getClass(), localization.getBundle());
    InvalidValue[] invalidValues = validator.getInvalidValues(object);

    for (InvalidValue value : invalidValues) {
      errors.add(new ValidationMessage(value.getMessage(), value.getPropertyPath()));
    }
    return errors;
  }