org.javalid.core.validator
Class AbstractLengthValidatorImpl<T extends java.lang.annotation.Annotation>
java.lang.Object
org.javalid.core.validator.AbstractJavalidValidatorImpl<T>
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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractLengthValidatorImpl
public AbstractLengthValidatorImpl()
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 checkcurrentPath - 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() propertycharSet - annotation.charSet() propertycurrentPath - 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 checkcountAs - annotation.countAs() propertycharSet - annotation.charSet() property
- Returns:
- Length of value