com.google.gwt.validation.rebind
Class ValidationPackage

java.lang.Object
  extended by com.google.gwt.validation.rebind.ValidationPackage

public class ValidationPackage
extends java.lang.Object

Rebind helper class that stores all the information about a method, field, and annotation set so that validation can either occur (as on the server) or so that validation code can be generated (as in the GWT compilation process).

Author:
chris

Constructor Summary
ValidationPackage(IConstraint<java.lang.annotation.Annotation> constraint, java.lang.String message, java.lang.reflect.Method method, java.lang.reflect.Field field, java.lang.String[] groups, java.util.Map<java.lang.String,java.lang.String> propertyMap)
          Create a validation package for the given constraint, with a message specified, for the method and field given that applies to the groups as specified, with the given property map for initilization of the constraint implementation.
 
Method Summary
<T> InvalidConstraint<T>
buildInvalidConstraint(T object)
          Build an InvalidConstraint object that matches the annotation
 java.util.ArrayList<java.lang.String> getGroups()
          Get the list of groups that this validation belongs in.
 IConstraint<java.lang.annotation.Annotation> getImplementingConstraint()
          Get an instance of the implementing constraint
 java.lang.String getItemName()
          Outward facing item name that represents the field or method to be validated
 java.lang.String getMessage()
          Get the message that will be used if validation fails
 java.lang.reflect.Method getMethod()
          Get the java.lang.reflect.Method that represents the method to invoke.
 java.util.Map<java.lang.String,java.lang.String> getValidationPropertyMap()
          Get the property map
 boolean isFieldBased()
          Returns true if the package is for a field with a getter method.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidationPackage

public ValidationPackage(IConstraint<java.lang.annotation.Annotation> constraint,
                         java.lang.String message,
                         java.lang.reflect.Method method,
                         java.lang.reflect.Field field,
                         java.lang.String[] groups,
                         java.util.Map<java.lang.String,java.lang.String> propertyMap)
Create a validation package for the given constraint, with a message specified, for the method and field given that applies to the groups as specified, with the given property map for initilization of the constraint implementation.
The parameter method is only null if it is a class level annotation.

Parameters:
constraint - the constraint that implements the validation
message - the message if the constraint fails (returns false on validation)
method - the method to invoke for validation
field - the field that the method maps to (if applicable)
groups - the groups that the validation should be performed under
propertyMap - the properties to be used to initialize the constraint
Method Detail

buildInvalidConstraint

public <T> InvalidConstraint<T> buildInvalidConstraint(T object)
Build an InvalidConstraint object that matches the annotation

Type Parameters:
T -
Returns:

getImplementingConstraint

public IConstraint<java.lang.annotation.Annotation> getImplementingConstraint()
Get an instance of the implementing constraint

Returns:

getValidationPropertyMap

public java.util.Map<java.lang.String,java.lang.String> getValidationPropertyMap()
Get the property map

Returns:

isFieldBased

public boolean isFieldBased()
Returns true if the package is for a field with a getter method.

Returns:

getMethod

public java.lang.reflect.Method getMethod()
Get the java.lang.reflect.Method that represents the method to invoke.

Returns:

getItemName

public java.lang.String getItemName()
Outward facing item name that represents the field or method to be validated

Returns:

getMessage

public java.lang.String getMessage()
Get the message that will be used if validation fails

Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getGroups

public java.util.ArrayList<java.lang.String> getGroups()
Get the list of groups that this validation belongs in.

Returns: