org.loom.validator
Class AbstractPropertyValidator

java.lang.Object
  extended by org.loom.validator.AbstractPropertyValidator
All Implemented Interfaces:
FormInputDecorator, PropertyValidator
Direct Known Subclasses:
AbstractRequiredValidator, DateValidator, MethodValidator, NumberValidator, StringValidator

public abstract class AbstractPropertyValidator
extends java.lang.Object
implements PropertyValidator


Constructor Summary
AbstractPropertyValidator()
           
 
Method Summary
 void decorate(FormInputTag tag)
          Add attributes to the tag based on this Validator instance metadata
protected  java.lang.String getMessagePrefix()
           
 java.lang.String getOverridenMessageKey()
          If not null, this will be the error message key used instead of the one suggested by the validator class.
 java.lang.String getPropertyPath()
          The property path that will be evaluated.
 boolean isBindMessages()
           
protected  boolean isValidateCollectionContainer()
           
 void pushPropertyPath(java.lang.String prefix)
          Adds a property node to the beginning of this property path
 void setBindMessages(boolean bindMessages)
           
protected  void setMessagePrefix(java.lang.String messagePrefix)
           
 void setOverridenMessageKey(java.lang.String message)
           
 void setPropertyPath(java.lang.String propertyPath)
           
protected  void setValidateCollectionContainer(boolean validateCollectionContainer)
           
 boolean validateCollectionContainer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.loom.validator.PropertyValidator
validate
 

Constructor Detail

AbstractPropertyValidator

public AbstractPropertyValidator()
Method Detail

decorate

public void decorate(FormInputTag tag)
Add attributes to the tag based on this Validator instance metadata

Specified by:
decorate in interface FormInputDecorator
Parameters:
tag - the tag to be modified

pushPropertyPath

public void pushPropertyPath(java.lang.String prefix)
Adds a property node to the beginning of this property path


getPropertyPath

public java.lang.String getPropertyPath()
Description copied from interface: PropertyValidator
The property path that will be evaluated. Must be not-null and non-empty

Specified by:
getPropertyPath in interface PropertyValidator

setPropertyPath

public void setPropertyPath(java.lang.String propertyPath)

validateCollectionContainer

public boolean validateCollectionContainer()
Specified by:
validateCollectionContainer in interface PropertyValidator
Returns:
true if this validation must be applied to containers (lists, maps, arrays) instead of its contents. If false, the validation will be applied to each content,if true it will be applied to the container. Defaults false

getOverridenMessageKey

public java.lang.String getOverridenMessageKey()
Description copied from interface: PropertyValidator
If not null, this will be the error message key used instead of the one suggested by the validator class.

Specified by:
getOverridenMessageKey in interface PropertyValidator
Returns:
the message key to be used from the MessagesRepository, default null.

setOverridenMessageKey

public void setOverridenMessageKey(java.lang.String message)

getMessagePrefix

protected java.lang.String getMessagePrefix()

setMessagePrefix

protected void setMessagePrefix(java.lang.String messagePrefix)

isValidateCollectionContainer

protected boolean isValidateCollectionContainer()

setValidateCollectionContainer

protected void setValidateCollectionContainer(boolean validateCollectionContainer)

isBindMessages

public boolean isBindMessages()
Specified by:
isBindMessages in interface PropertyValidator
Returns:
true to bind error messages to the property name, false to use unbound Message

setBindMessages

public void setBindMessages(boolean bindMessages)