Class AnnotationModule
- java.lang.Object
-
- com.github.collinalpert.java2db.modules.AnnotationModule
-
public class AnnotationModule extends java.lang.ObjectA helper module which provides functionality for getting information from annotations.- Author:
- Collin Alpert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnnotationModule.AnnotationInfo<A extends java.lang.annotation.Annotation>A helper class for determining information of an annotation above a field.
-
Constructor Summary
Constructors Constructor Description AnnotationModule()
-
Method Summary
Modifier and Type Method Description <A extends java.lang.annotation.Annotation>
AnnotationModule.AnnotationInfo<A>getAnnotationInfo(java.lang.reflect.Field field, java.lang.Class<A> annotationClass)Gets information to an annotation for a field.<A extends java.lang.annotation.Annotation>
AnnotationModule.AnnotationInfo<A>getAnnotationInfo(java.lang.reflect.Field field, java.lang.Class<A> annotationClass, java.util.function.Function<A,java.lang.Boolean> additionalCondition)Gets information to an annotation for a field and performs an additional condition if the field has been annotated.<A extends java.lang.annotation.Annotation>
booleanhasAnnotation(java.lang.reflect.Field field, java.lang.Class<A> annotationClass)Checks if a field was annotated with a specific annotation.<A extends java.lang.annotation.Annotation>
booleanhasAnnotation(java.lang.reflect.Field field, java.lang.Class<A> annotationClass, java.util.function.Function<A,java.lang.Boolean> additionalCondition)Checks if a field was annotated with a specific annotation and performs an additional condition if so.
-
-
-
Method Detail
-
hasAnnotation
public <A extends java.lang.annotation.Annotation> boolean hasAnnotation(java.lang.reflect.Field field, java.lang.Class<A> annotationClass)Checks if a field was annotated with a specific annotation.- Type Parameters:
A- The type of the annotation.- Parameters:
field- The field to check.annotationClass- The annotation to check for.- Returns:
True, if the field was annotated with this annotation,falseotherwise.
-
hasAnnotation
public <A extends java.lang.annotation.Annotation> boolean hasAnnotation(java.lang.reflect.Field field, java.lang.Class<A> annotationClass, java.util.function.Function<A,java.lang.Boolean> additionalCondition)Checks if a field was annotated with a specific annotation and performs an additional condition if so.- Type Parameters:
A- The type of the annotation.- Parameters:
field- The field to check.annotationClass- The annotation to check for.additionalCondition- An additional condition to perform on the annotation. This condition is only executed if the field was annotated with the specified annotation.- Returns:
True, if the field was annotated with this annotation and the additional condition evaluates totrue,falseotherwise.
-
getAnnotationInfo
public <A extends java.lang.annotation.Annotation> AnnotationModule.AnnotationInfo<A> getAnnotationInfo(java.lang.reflect.Field field, java.lang.Class<A> annotationClass)
Gets information to an annotation for a field.- Type Parameters:
A- The type of the annotation.- Parameters:
field- The field to get annotation information from.annotationClass- The annotation to check for.- Returns:
- Information concerning a specific annotation of a field.
-
getAnnotationInfo
public <A extends java.lang.annotation.Annotation> AnnotationModule.AnnotationInfo<A> getAnnotationInfo(java.lang.reflect.Field field, java.lang.Class<A> annotationClass, java.util.function.Function<A,java.lang.Boolean> additionalCondition)
Gets information to an annotation for a field and performs an additional condition if the field has been annotated.- Type Parameters:
A- The type of the annotation.- Parameters:
field- The field to get annotation information from.annotationClass- The annotation to check for.additionalCondition- An additional condition to perform on the annotation. This condition is only executed if the field was annotated with the specified annotation.- Returns:
- Information concerning a specific annotation of a field.
-
-