org.javalid.core.cache
Class AnnotationFieldCache

java.lang.Object
  extended by org.javalid.core.cache.AnnotationFieldCache
All Implemented Interfaces:
java.io.Serializable, AnnotationBaseCache, AnnotationCache

public class AnnotationFieldCache
extends java.lang.Object
implements java.io.Serializable, AnnotationCache

Implementation cache for fields, storing all information about a field related to annotations.

Since:
1.2
Version:
1.0
Author:
M.Reuvers
See Also:
Serialized Form

Constructor Summary
AnnotationFieldCache(JvGroup jvGroup, java.lang.String fieldName)
           
 
Method Summary
 void addAnnotation(java.lang.annotation.Annotation annotation)
          Add a new annotation for this field / method (must be an annotation supported by JaValid.
 java.lang.String createValidationPath(java.lang.String currentPath)
          Returns a new path appended to currentPath, if currentPath is empty returns the name of the field / method only.
 java.util.List<java.lang.annotation.Annotation> getAnnotations()
          Returns an immutable list with all annotations that are on the the field / method - supported by JaValid.
 JvGroup getJvGroup()
          Returns the group annotation that was on the field, method or class.
 java.lang.String getName()
          Returns name of field / method.
 NotEmpty getNotEmptyAnnotation()
          If present, returns the NotEmpty annotation, else returns null.
 NotNull getNotNullAnnotation()
          If present, returns the NotNull annotation, else returns null.
 StopValidation getStopValidationAnnotation()
          If present, returns the StopValidation annotation else returns null.
 boolean hasAnnotations()
          Returns true if at least one (javalid) supported annotation is present.
 boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
          Returns true if given annotation is present in the map (at least once)
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationFieldCache

public AnnotationFieldCache(JvGroup jvGroup,
                            java.lang.String fieldName)
Method Detail

getJvGroup

public JvGroup getJvGroup()
Description copied from interface: AnnotationBaseCache
Returns the group annotation that was on the field, method or class.

Specified by:
getJvGroup in interface AnnotationBaseCache
Returns:
JvGroup that was on the field or method

getAnnotations

public java.util.List<java.lang.annotation.Annotation> getAnnotations()
Description copied from interface: AnnotationBaseCache
Returns an immutable list with all annotations that are on the the field / method - supported by JaValid.

Specified by:
getAnnotations in interface AnnotationBaseCache
Returns:
Immutable list with annotations

addAnnotation

public void addAnnotation(java.lang.annotation.Annotation annotation)
Description copied from interface: AnnotationBaseCache
Add a new annotation for this field / method (must be an annotation supported by JaValid.

Specified by:
addAnnotation in interface AnnotationBaseCache
Parameters:
annotation - New annotation

isAnnotationPresent

public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Description copied from interface: AnnotationBaseCache
Returns true if given annotation is present in the map (at least once)

Specified by:
isAnnotationPresent in interface AnnotationBaseCache
Parameters:
annotation - The annotation to check
Returns:
True if present, false otherwise.

getNotNullAnnotation

public NotNull getNotNullAnnotation()
Description copied from interface: AnnotationCache
If present, returns the NotNull annotation, else returns null.

Specified by:
getNotNullAnnotation in interface AnnotationCache
Returns:
NotNull if present, null otherwise.

getNotEmptyAnnotation

public NotEmpty getNotEmptyAnnotation()
Description copied from interface: AnnotationCache
If present, returns the NotEmpty annotation, else returns null.

Specified by:
getNotEmptyAnnotation in interface AnnotationCache
Returns:
NotEmpty if present, null otherwise.

createValidationPath

public java.lang.String createValidationPath(java.lang.String currentPath)
Description copied from interface: AnnotationCache
Returns a new path appended to currentPath, if currentPath is empty returns the name of the field / method only.

Specified by:
createValidationPath in interface AnnotationCache
Parameters:
currentPath - The current path to pre-pend
Returns:
New validation path

getStopValidationAnnotation

public StopValidation getStopValidationAnnotation()
Description copied from interface: AnnotationCache
If present, returns the StopValidation annotation else returns null.

Specified by:
getStopValidationAnnotation in interface AnnotationCache
Returns:
StopValidation if pressent, null otherwise.

getName

public java.lang.String getName()
Description copied from interface: AnnotationCache
Returns name of field / method.

Specified by:
getName in interface AnnotationCache
Returns:
Name of field / method.

hasAnnotations

public boolean hasAnnotations()
Description copied from interface: AnnotationBaseCache
Returns true if at least one (javalid) supported annotation is present.

Specified by:
hasAnnotations in interface AnnotationBaseCache
Returns:
True if at least one javalid supported annotation is present, false otherwise.

toString

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