org.apache.bval.jsr303
Class GroupValidationContextImpl<T>

java.lang.Object
  extended by org.apache.bval.BeanValidationContext<ConstraintValidationListener<T>>
      extended by org.apache.bval.jsr303.GroupValidationContextImpl<T>
All Implemented Interfaces:
MessageInterpolator.Context, GroupValidationContext<T>, ValidationContext<ConstraintValidationListener<T>>

final class GroupValidationContextImpl<T>
extends BeanValidationContext<ConstraintValidationListener<T>>
implements GroupValidationContext<T>, MessageInterpolator.Context

Description: instance per validation process, not thread-safe


Field Summary
 
Fields inherited from class org.apache.bval.BeanValidationContext
validatedObjects
 
Constructor Summary
GroupValidationContextImpl(ConstraintValidationListener<T> listener, MessageInterpolator aMessageResolver, TraversableResolver traversableResolver, MetaBean rootMetaBean)
          Create a new GroupValidationContextImpl instance.
 
Method Summary
 boolean collectValidated()
           Here, state equates to bean identity + group.
 boolean collectValidated(ConstraintValidator<?,?> constraint)
          Accumulate a validated constraint.
 ConstraintDescriptor<?> getConstraintDescriptor()
          
 ConstraintValidation<?> getConstraintValidation()
          Get the ConstraintValidation.
 Group getCurrentGroup()
          Get the current Group.
 Class<?> getCurrentOwner()
          Get the current owning class.
 Groups getGroups()
          Get the groups of this GroupValidationContext.
 MessageInterpolator getMessageResolver()
          Get the message resolver.
 PathImpl getPropertyPath()
          Get the property path.
 MetaBean getRootMetaBean()
          Get the root MetaBean.
 TraversableResolver getTraversableResolver()
          Get the TraversableResolver.
 Object getValidatedValue()
          Get the value being validated.
 void moveDown(MetaProperty prop, AccessStrategy access)
          
 void moveUp(Object bean, MetaBean metaBean)
          
 void resetValidatedConstraints()
          Reset the validated constraints.
 void setConstraintValidation(ConstraintValidation<?> constraint)
          Set the ConstraintValidation.
 void setCurrentGroup(Group currentGroup)
          Set the current Group.
 void setCurrentIndex(Integer index)
          
 void setCurrentKey(Object key)
          
 void setCurrentOwner(Class<?> currentOwner)
          Set the current owning class.
 void setGroups(Groups groups)
          Set the Groups.
 
Methods inherited from class org.apache.bval.BeanValidationContext
getAccess, getBean, getListener, getMeta, getMetaBean, getMetaProperty, getPropertyName, getPropertyValue, getPropertyValue, isFixed, isValidated, resetValidated, setBean, setBean, setFixed, setFixedValue, setListener, setMetaBean, setMetaProperty, setPropertyValue, toString, unknownValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.bval.jsr303.GroupValidationContext
setFixedValue
 
Methods inherited from interface org.apache.bval.model.ValidationContext
getAccess, getBean, getListener, getMetaBean, getMetaProperty, getPropertyName, getPropertyValue, getPropertyValue, setBean, setBean, setMetaBean, setMetaProperty
 

Constructor Detail

GroupValidationContextImpl

public GroupValidationContextImpl(ConstraintValidationListener<T> listener,
                                  MessageInterpolator aMessageResolver,
                                  TraversableResolver traversableResolver,
                                  MetaBean rootMetaBean)
Create a new GroupValidationContextImpl instance.

Parameters:
listener -
aMessageResolver -
traversableResolver -
rootMetaBean -
Method Detail

setCurrentIndex

public void setCurrentIndex(Integer index)

Specified by:
setCurrentIndex in interface ValidationContext<ConstraintValidationListener<T>>
Overrides:
setCurrentIndex in class BeanValidationContext<ConstraintValidationListener<T>>

setCurrentKey

public void setCurrentKey(Object key)

Specified by:
setCurrentKey in interface ValidationContext<ConstraintValidationListener<T>>
Overrides:
setCurrentKey in class BeanValidationContext<ConstraintValidationListener<T>>

moveDown

public void moveDown(MetaProperty prop,
                     AccessStrategy access)

Specified by:
moveDown in interface ValidationContext<ConstraintValidationListener<T>>
Overrides:
moveDown in class BeanValidationContext<ConstraintValidationListener<T>>

moveUp

public void moveUp(Object bean,
                   MetaBean metaBean)

Specified by:
moveUp in interface ValidationContext<ConstraintValidationListener<T>>
Overrides:
moveUp in class BeanValidationContext<ConstraintValidationListener<T>>

collectValidated

public boolean collectValidated()
Here, state equates to bean identity + group.

Specified by:
collectValidated in interface ValidationContext<ConstraintValidationListener<T>>
Overrides:
collectValidated in class BeanValidationContext<ConstraintValidationListener<T>>

collectValidated

public boolean collectValidated(ConstraintValidator<?,?> constraint)
Accumulate a validated constraint.

Specified by:
collectValidated in interface GroupValidationContext<T>
Returns:
true when the constraint for the object in this path was not already validated in this context

resetValidatedConstraints

public void resetValidatedConstraints()
Reset the validated constraints.


getPropertyPath

public PathImpl getPropertyPath()
Get the property path. If an associated object is validated, add the association field or JavaBeans property name and a dot ('.') as a prefix to the previous rules. uses prop[index] in property path for elements in to-many-relationships.

Specified by:
getPropertyPath in interface GroupValidationContext<T>
Returns:
the path in dot notation

getRootMetaBean

public MetaBean getRootMetaBean()
Get the root MetaBean.

Specified by:
getRootMetaBean in interface GroupValidationContext<T>
Returns:
MetaBean

setGroups

public void setGroups(Groups groups)
Set the Groups.

Parameters:
groups -

getGroups

public Groups getGroups()
Get the groups of this GroupValidationContext.

Specified by:
getGroups in interface GroupValidationContext<T>
Returns:
the groups in their sequence for validation

getCurrentGroup

public Group getCurrentGroup()
Get the current Group.

Specified by:
getCurrentGroup in interface GroupValidationContext<T>
Returns:
Group

setCurrentGroup

public void setCurrentGroup(Group currentGroup)
Set the current Group.

Specified by:
setCurrentGroup in interface GroupValidationContext<T>
Parameters:
currentGroup - to set

setConstraintValidation

public void setConstraintValidation(ConstraintValidation<?> constraint)
Set the ConstraintValidation.

Specified by:
setConstraintValidation in interface GroupValidationContext<T>
Parameters:
constraint - to set

getConstraintValidation

public ConstraintValidation<?> getConstraintValidation()
Get the ConstraintValidation.

Specified by:
getConstraintValidation in interface GroupValidationContext<T>
Returns:
ConstraintValidation

getConstraintDescriptor

public ConstraintDescriptor<?> getConstraintDescriptor()

Specified by:
getConstraintDescriptor in interface MessageInterpolator.Context

getValidatedValue

public Object getValidatedValue()
Get the value being validated.

Specified by:
getValidatedValue in interface MessageInterpolator.Context
Specified by:
getValidatedValue in interface GroupValidationContext<T>
Returns:
Object

getMessageResolver

public MessageInterpolator getMessageResolver()
Get the message resolver.

Specified by:
getMessageResolver in interface GroupValidationContext<T>
Returns:
MessageInterpolator

getTraversableResolver

public TraversableResolver getTraversableResolver()
Get the TraversableResolver.

Specified by:
getTraversableResolver in interface GroupValidationContext<T>
Returns:
TraversableResolver

getCurrentOwner

public Class<?> getCurrentOwner()
Get the current owning class.

Specified by:
getCurrentOwner in interface GroupValidationContext<T>
Returns:
Class

setCurrentOwner

public void setCurrentOwner(Class<?> currentOwner)
Set the current owning class.

Specified by:
setCurrentOwner in interface GroupValidationContext<T>
Parameters:
currentOwner - to set


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.