Interface AnnotationAccessor
public interface AnnotationAccessor
Represents an annotation accessor, a controlled manner of accessing (field) annotations.
- Since:
- 3.0.0
- Author:
- MrIvanPlays
-
Field Summary
Modifier and TypeFieldDescriptionstatic final AnnotationAccessor
Returns anAnnotationAccessor
, whichgetAnnotation(Class)
method will always returnOptional.empty()
-
Method Summary
Modifier and TypeMethodDescriptionstatic AnnotationAccessor
createFromField
(Field field) <T extends Annotation>
Optional<T>getAnnotation
(Class<T> annotationClass) Returns anOptional
, which may be fulfilled with the neededAnnotation
, nailed to the specifiedClass
annotationClass
.
-
Field Details
-
EMPTY
Returns anAnnotationAccessor
, whichgetAnnotation(Class)
method will always returnOptional.empty()
-
-
Method Details
-
createFromField
- Parameters:
field
- field to create annotation accessor from- Returns:
- annotation accessor
-
getAnnotation
Returns anOptional
, which may be fulfilled with the neededAnnotation
, nailed to the specifiedClass
annotationClass
.- Type Parameters:
T
- annotation type- Parameters:
annotationClass
- annotation class- Returns:
- annotation or empty optional
-