org.javalid.core.validator
Class AbstractLengthValidatorImpl<T extends java.lang.annotation.Annotation>

java.lang.Object
  extended by org.javalid.core.validator.AbstractJavalidValidatorImpl<T>
      extended by org.javalid.core.validator.AbstractLengthValidatorImpl<T>
All Implemented Interfaces:
JavalidValidator<T>
Direct Known Subclasses:
BetweenLengthValidatorImpl, ExactLengthValidatorImpl, MaxLengthValidatorImpl, MinLengthValidatorImpl

public abstract class AbstractLengthValidatorImpl<T extends java.lang.annotation.Annotation>
extends AbstractJavalidValidatorImpl<T>

Super class of length validators. Contains a few shared methods.

Since:
1.2
Version:
1.0
Author:
M.Reuvers

Constructor Summary
AbstractLengthValidatorImpl()
           
 
Method Summary
protected  java.lang.String convertValueToString(java.lang.Object value, java.lang.String currentPath)
          Checks if value is not null, then checks if it is of type String, StringBuffer or StringBuilder and returns the value as String.
protected  int determineLength(java.lang.String value, java.lang.String countAs, java.lang.String charSet)
          Returns the length based on value, the countAs and charSet.
protected  void validateCountAsAndCharset(java.lang.String countAs, java.lang.String charSet, java.lang.String currentPath)
          Checks and validates countAs and charSet parameters
 
Methods inherited from class org.javalid.core.validator.AbstractJavalidValidatorImpl
checkIsSingleExpression, doValidate, requiresComplexCall, validate, validateComplex, validationMustBeAppliedToGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLengthValidatorImpl

public AbstractLengthValidatorImpl()
Method Detail

convertValueToString

protected java.lang.String convertValueToString(java.lang.Object value,
                                                java.lang.String currentPath)
Checks if value is not null, then checks if it is of type String, StringBuffer or StringBuilder and returns the value as String.

Parameters:
value - The value to check
currentPath - Current validation path
Returns:
Value as String

validateCountAsAndCharset

protected void validateCountAsAndCharset(java.lang.String countAs,
                                         java.lang.String charSet,
                                         java.lang.String currentPath)
Checks and validates countAs and charSet parameters

Parameters:
countAs - annotation.countAs() property
charSet - annotation.charSet() property
currentPath - The current path

determineLength

protected int determineLength(java.lang.String value,
                              java.lang.String countAs,
                              java.lang.String charSet)
Returns the length based on value, the countAs and charSet.

Parameters:
value - The value to check
countAs - annotation.countAs() property
charSet - annotation.charSet() property
Returns:
Length of value