Enum CustomAnnotationRegistry
java.lang.Object
java.lang.Enum<CustomAnnotationRegistry>
com.mrivanplays.annotationconfig.core.annotations.custom.CustomAnnotationRegistry
- All Implemented Interfaces:
Serializable
,Comparable<CustomAnnotationRegistry>
,java.lang.constant.Constable
Represents a registry for custom annotations.
- Since:
- 2.0.0
- Author:
- MrIvanPlays
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionOptional<AnnotationValidator<? extends Annotation>>
getValidator
(Class<? extends Annotation> annotationClass) Returns theAnnotationValidator
bound to the specifiedannotationClass
.boolean
hasValidator
(Class<? extends Annotation> annotation) Returns whether the specifiedannotation
has a validator.boolean
isEmpty()
Returns whether the registry contains any validators.<T extends Annotation>
voidregister
(Class<T> annotation, AnnotationValidator<T> validator) void
unregister
(Class<? extends Annotation> annotation) Removes the bound to the specifiedannotation
AnnotationValidator
if there is any.static CustomAnnotationRegistry
Returns the enum constant of this type with the specified name.static CustomAnnotationRegistry[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
register
- Type Parameters:
T
- annotation type- Parameters:
annotation
- the annotation you want this validator to be bound tovalidator
- the bind validator- Throws:
IllegalArgumentException
- if the annotation already has a validator.
-
unregister
Removes the bound to the specifiedannotation
AnnotationValidator
if there is any.- Parameters:
annotation
- the annotation you want to remove the validator of- Throws:
IllegalArgumentException
- if no validator was present for the specified annotation
-
hasValidator
Returns whether the specifiedannotation
has a validator.- Parameters:
annotation
- the annotation you want to check for validator- Returns:
- true if there is a validator, false otherwise
-
isEmpty
Returns whether the registry contains any validators.- Returns:
- true if empty, false otherwise.
-
getValidator
public Optional<AnnotationValidator<? extends Annotation>> getValidator(Class<? extends Annotation> annotationClass) Returns theAnnotationValidator
bound to the specifiedannotationClass
.- Parameters:
annotationClass
- the annotation of which you want the validator- Returns:
- annotation validator optional, which can be empty
-