org.jboss.seam.core
Class Validators

java.lang.Object
  extended by org.jboss.seam.core.Validators

@Name(value="org.jboss.seam.core.validators")
@BypassInterceptors
@Scope(value=APPLICATION)
@Install(precedence=0,
         classDependencies="org.hibernate.validator.ClassValidator")
public class Validators
extends Object

Caches instances of Hibernate Validator ClassValidator

Author:
Gavin King

Constructor Summary
Validators()
           
 
Method Summary
protected
<T> org.hibernate.validator.ClassValidator<T>
createValidator(Class<T> modelClass)
          Create a new ClassValidator for the given class, using the current Seam ResourceBundle.
<T> org.hibernate.validator.ClassValidator<T>
getValidator(Class<T> modelClass)
          Get the cached ClassValidator instance.
<T> org.hibernate.validator.ClassValidator<T>
getValidator(T model)
          Get the cached ClassValidator instance.
static Validators instance()
           
 org.hibernate.validator.InvalidValue[] validate(javax.el.ValueExpression valueExpression, javax.el.ELContext elContext, Object value)
          Validate that the given value can be assigned to the property given by the value expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Validators

public Validators()
Method Detail

getValidator

public <T> org.hibernate.validator.ClassValidator<T> getValidator(T model)
Get the cached ClassValidator instance. If the argument is an instance of a session bean Seam component instance, the returned validator will be aware of constraints defined on the bean class. Therefore this method is preferred to getValidator(Class) if the argument might be a session bean.

Parameters:
model - the object to be validated

getValidator

public <T> org.hibernate.validator.ClassValidator<T> getValidator(Class<T> modelClass)
Get the cached ClassValidator instance.

Parameters:
modelClass - the class to be validated

createValidator

protected <T> org.hibernate.validator.ClassValidator<T> createValidator(Class<T> modelClass)
Create a new ClassValidator for the given class, using the current Seam ResourceBundle.

Parameters:
modelClass - the class to be validated

validate

public org.hibernate.validator.InvalidValue[] validate(javax.el.ValueExpression valueExpression,
                                                       javax.el.ELContext elContext,
                                                       Object value)
Validate that the given value can be assigned to the property given by the value expression.

Parameters:
valueExpression - a value expression, referring to a property
elContext - the ELContext in which to evaluate the expression
value - a value to be assigned to the property
Returns:
a set of potential InvalidValues, from Hibernate Validator

instance

public static Validators instance()