Package de.exlll.configlib
Interface ConfigurationElement<T extends AnnotatedElement>
- Type Parameters:
T- the type of the element
public sealed interface ConfigurationElement<T extends AnnotatedElement>
Represents an element of a serializable configuration type. The element can either be a
Field for configuration classes or a RecordComponent for records.-
Method Summary
Modifier and TypeMethodDescriptionReturns the annotated type of the element.default <A extends Annotation>
Aannotation(Class<A> annotationType) Returns the annotation of the given type or null if the element is not annotated with such an annotation.Class<?>Returns the configuration type that defines this element.element()Returns the element itself.name()Returns the name of the element.Class<?>type()Returns the type of the element.Given an instance of the configuration type which defines this element, returns the value the element is holding.
-
Method Details
-
element
T element()Returns the element itself.- Returns:
- the element
-
name
String name()Returns the name of the element.- Returns:
- name of the element
-
type
Class<?> type()Returns the type of the element.- Returns:
- type of the element
-
annotatedType
AnnotatedType annotatedType()Returns the annotated type of the element.- Returns:
- annotated type of element
-
value
Given an instance of the configuration type which defines this element, returns the value the element is holding.- Parameters:
elementHolder- an instance of the configuration type that defines this element- Returns:
- value the element is holding
- Throws:
IllegalArgumentException- ifelementHolderis not an instance of the configuration type which defines this element
-
declaringType
Class<?> declaringType()Returns the configuration type that defines this element.- Returns:
- the configuration type that defines this element
-
annotation
Returns the annotation of the given type or null if the element is not annotated with such an annotation.- Type Parameters:
A- the type of annotation- Parameters:
annotationType- the type of annotation- Returns:
- the annotation or null
- Throws:
NullPointerException- ifannotationTypeis null
-