com.pmease.quickbuild.rest.validation
Class Validator

java.lang.Object
  extended by com.pmease.quickbuild.rest.validation.Validator

public class Validator
extends java.lang.Object

A simple facade for Hibernate Validator.


Constructor Summary
Validator()
           
Validator(javax.validation.ValidatorFactory factory)
           
 
Method Summary
<T> com.google.common.collect.ImmutableList<java.lang.String>
validate(T o)
          Validates the given object, and returns a list of error messages, if any.
<T> com.google.common.collect.ImmutableList<java.lang.String>
validate(T o, java.lang.Class<?>... groups)
          Validates the given object, and returns a list of error messages, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Validator

public Validator()

Validator

public Validator(javax.validation.ValidatorFactory factory)
Method Detail

validate

public <T> com.google.common.collect.ImmutableList<java.lang.String> validate(T o)
Validates the given object, and returns a list of error messages, if any. If the returned list is empty, the object is valid.

Type Parameters:
T - the type of object to validate
Parameters:
o - a potentially-valid object
Returns:
a list of error messages, if any, regarding o's validity

validate

public <T> com.google.common.collect.ImmutableList<java.lang.String> validate(T o,
                                                                              java.lang.Class<?>... groups)
Validates the given object, and returns a list of error messages, if any. If the returned list is empty, the object is valid.

Type Parameters:
T - the type of object to validate
Parameters:
o - a potentially-valid object
groups - group or list of groups targeted for validation (default to Default)
Returns:
a list of error messages, if any, regarding o's validity


Copyright © 2005-2010 PMEase Inc. All Rights Reserved.