Class ReflectionUtils.TypeMetadata
java.lang.Object
io.fluxzero.common.reflection.ReflectionUtils.TypeMetadata
- Enclosing class:
ReflectionUtils
Lazily computed reflection metadata for a single Java type.
This is the central cache for type-level reflection in Fluxzero. It keeps the structural model of a type
together in one place: methods, fields, property descriptors, type annotations, annotated members, cached
property-path accessors, and compiled MemberInvoker instances.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class -
Method Summary
Modifier and TypeMethodDescriptionannotatedExecutables(Class<? extends Annotation> annotation) Returns annotated methods, including inherited methods, followed by annotated constructors declared by this type.annotatedFields(Class<? extends Annotation> annotation) Returns fields matching the requested annotation directly or through a meta-annotation.annotatedMethods(Class<? extends Annotation> annotation) Returns methods matching the requested annotation, including composed annotations and overridden declarations.List<? extends AccessibleObject> annotatedProperties(Class<? extends Annotation> annotation) Returns matching fields and readable methods, including interface properties, deduplicated by logical property name.Optional<? extends AccessibleObject> annotatedProperty(Class<? extends Annotation> annotation) Returns the first matching annotated property, or an empty optional if none exists.annotatedPropertyInvoker(Class<? extends Annotation> annotation) Returns a cached invoker for the first matching annotated property, with reflective access enabled.<T> Optional<T> annotationAs(AnnotatedElement member, Class<? extends Annotation> annotationType, Class<? extends T> returnType) Returns a cached projection of the matching annotation into the requested representation, or an empty optional if absent.annotations(AnnotatedElement element) Returns cached annotations for the supplied element.booleandeclaresField(String fieldName) Returns whether this type itself declares the named field; inherited fields do not count.Optional<Constructor<?>> Returns the type's no-argument constructor, if one exists.Returns the first discovered field with this name, including inherited fields.<A extends Annotation>
Optional<A> fieldAnnotation(Field field, Class<? extends Annotation> annotation) Returns the field's direct or composed annotation, if present; a composed match returns the outer annotation instance.fields()Returns the cached, immutable list of discovered fields across the type hierarchy.Returns a cached reader for a nested property path, accepting dot or slash separators.Returns the class-owned cached invoker for the member and access policy.Returns the first discovered method with this name, without selecting by parameter types.<A extends Annotation>
Optional<A> methodAnnotation(Executable executable, Class<? extends Annotation> annotation) Returns the first direct or composed annotation found along the executable's override hierarchy.<A extends Annotation>
List<A> methodAnnotations(Executable executable, Class<? extends Annotation> annotation) Returns matching annotations from the first declaration in the override hierarchy that supplies any.methods()Returns the cached, immutable list of discovered methods across the type hierarchy.Returns all discovered overloads with this name, or an empty list if none exists.propertyPath(String propertyPath) Returns cached structural metadata for the normalized nested property path, including missing and dynamically resolved paths.Returns a cached writer for a nested property path, accepting dot or slash separators.<M> MspecializedMetadata(Class<M> metadataType, Function<Class<?>, ? extends M> factory) Returns type-specific structural metadata owned by this central type cache.Class<?> type()Returns the class whose structural metadata this instance owns.<A extends Annotation>
AtypeAnnotation(Class<? extends Annotation> annotationType) Returns a matching direct or composed type annotation, or null.Collection<? extends Annotation> Returns type and interface annotations, deduplicated by annotation type.
-
Method Details
-
type
Returns the class whose structural metadata this instance owns. -
methods
-
defaultConstructor
Returns the type's no-argument constructor, if one exists. -
method
-
methods
-
fields
-
field
-
declaresField
Returns whether this type itself declares the named field; inherited fields do not count. -
typeAnnotations
Returns type and interface annotations, deduplicated by annotation type. -
annotations
Returns cached annotations for the supplied element. -
typeAnnotation
Returns a matching direct or composed type annotation, or null. For a composed annotation, returns the outer annotation instance. -
annotatedFields
Returns fields matching the requested annotation directly or through a meta-annotation. -
annotatedMethods
Returns methods matching the requested annotation, including composed annotations and overridden declarations. -
annotatedExecutables
Returns annotated methods, including inherited methods, followed by annotated constructors declared by this type. -
annotatedProperties
Returns matching fields and readable methods, including interface properties, deduplicated by logical property name. -
annotatedProperty
public Optional<? extends AccessibleObject> annotatedProperty(Class<? extends Annotation> annotation) Returns the first matching annotated property, or an empty optional if none exists. -
annotatedPropertyInvoker
Returns a cached invoker for the first matching annotated property, with reflective access enabled. -
getter
-
setter
Returns a cached writer for a nested property path, accepting dot or slash separators. Missing properties raiseReflectionUtils.PropertyNotFoundExceptionwhen resolved or written. -
propertyPath
Returns cached structural metadata for the normalized nested property path, including missing and dynamically resolved paths. -
invoker
Returns the class-owned cached invoker for the member and access policy. -
specializedMetadata
Returns type-specific structural metadata owned by this central type cache.SDK features can use this extension point for immutable metadata that is derived only from
type(). Runtime or instance state must not be captured by the factory or the returned value. Concurrent or reentrant first access may compute more than one value; all callers receive the first value published successfully.- Type Parameters:
M- metadata type- Parameters:
metadataType- unique metadata kind and expected result typefactory- computes non-null metadata from this Java type on first access- Returns:
- the cached metadata instance
-
fieldAnnotation
public <A extends Annotation> Optional<A> fieldAnnotation(Field field, Class<? extends Annotation> annotation) Returns the field's direct or composed annotation, if present; a composed match returns the outer annotation instance. -
methodAnnotation
public <A extends Annotation> Optional<A> methodAnnotation(Executable executable, Class<? extends Annotation> annotation) Returns the first direct or composed annotation found along the executable's override hierarchy. -
methodAnnotations
public <A extends Annotation> List<A> methodAnnotations(Executable executable, Class<? extends Annotation> annotation) Returns matching annotations from the first declaration in the override hierarchy that supplies any. -
annotationAs
public <T> Optional<T> annotationAs(AnnotatedElement member, Class<? extends Annotation> annotationType, Class<? extends T> returnType) Returns a cached projection of the matching annotation into the requested representation, or an empty optional if absent.
-