Class ReflectionUtils
This class is intended for internal use only. It provides a wide range of methods for accessing and manipulating object members via reflection, including:
- Resolving annotated fields and methods (with support for meta-annotations)
- Accessing nested property paths via getters and setters (e.g.,
"user/address/street") - Efficient member access using
DefaultMemberInvoker, which leveragesLambdaMetafactoryfor near-native invocation performance - Generic type resolution, including collection element types and supertype inference
- Annotation hierarchy traversal and support for Kotlin nullability reflection (if available)
- Utilities for determining override relationships, class hierarchies, and bean property metadata
- Robust handling of
Classloading and safe access to field/method/property values
Performance Considerations
This class uses extensive caching and memoization to avoid redundant reflective operations at runtime. All public methods are safe to use in high-performance contexts such as annotation scanning, handler dispatching, and JSON schema validation.Modular Use
If Fluxzero adopts JPMS (Project Jigsaw) in the future, this utility would likely be placed in an internal module and not exported to consumers, to preserve encapsulation and forward compatibility.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classLazily computed reflection metadata for a single Java type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> Returns the represented Java class for a class literal, or the runtime class of an ordinary object.static <T> TasInstance(Object classOrInstance) Instantiates a Java or supported Kotlin class literal using its no-argument constructor; returns ordinary instances unchanged.static Class<?> Converts a primitive type to its wrapper class and leaves non-primitive types unchanged.static booleanclassExists(String className) Returns whether the SDK's class lookup can resolve the supplied class name.static Class<?> classForName(String type) Resolves a class name through the SDK's class lookup; throwsClassNotFoundExceptionif unresolved.static Class<?> classForName(String type, Class<?> defaultClass) Resolves a class name, returningdefaultClasswhen it cannot be resolved.static <T> TconvertAnnotation(Annotation annotation, Class<? extends T> returnType) Converts the annotation's attributes into the requested representation.static <V> VcopyFields(V source, V target) Copies all non-static fields between objects of the same runtime class and returns the target.static booleandeclaresField(Class<?> target, String fieldName) Returns whether the target type itself declares the named field, excluding inherited fields.determineCommonAncestors(Collection<?> elements) Returns common ancestor types for the runtime classes of the elements, treating null elements asVoid.static <T extends AccessibleObject>
TensureAccessible(T member) Enables reflective access to the member and returns it; platform access restrictions can still reject the operation.getAllInterfaces(Class<?> type) Returns all interfaces implemented by the supplied type, including interfaces inherited through superclasses and parent interfaces.getAllMethods(Class<?> type) Returns the cached methods discovered across the type hierarchy.getAnnotatedFields(Class<?> target, Class<? extends Annotation> annotation) Returns discovered fields carrying the annotation directly or through a meta-annotation.getAnnotatedFields(Object target, Class<? extends Annotation> annotation) Returns matching annotated fields on the target or represented class, or an empty list for a null target.getAnnotatedMethods(Class<?> target, Class<? extends Annotation> annotation) Returns discovered methods carrying the annotation directly, through a meta-annotation, or through an overridden declaration.getAnnotatedMethods(Object target, Class<? extends Annotation> annotation) Returns matching annotated methods on the target's runtime class, or an empty list for a null target.static List<? extends AccessibleObject> getAnnotatedProperties(Class<?> target, Class<? extends Annotation> annotation) Returns annotated fields and readable methods, deduplicated by property name, including inherited and meta-annotated properties.static Optional<? extends AccessibleObject> getAnnotatedProperty(Class<?> target, Class<? extends Annotation> annotation) Returns the first annotated property discovered for the type, or an empty optional when none matches.static Optional<? extends AccessibleObject> getAnnotatedProperty(Object target, Class<? extends Annotation> annotation) Returns the first matching annotated property on the target or represented class, or an empty optional for a null target.static Optional<MemberInvoker> getAnnotatedPropertyInvoker(Class<?> target, Class<? extends Annotation> annotation) Returns a cached invoker for the first matching annotated property, with reflective access enabled.getAnnotatedPropertyName(Object target, Class<? extends Annotation> annotation) Returns the logical name of the first matching annotated property, if present.getAnnotatedPropertyValue(Object target, Class<? extends Annotation> annotation) Reads the first matching annotated property, returning an empty optional for a missing or null value.static ObjectgetAnnotatedPropertyValueOrNull(Object target, Class<? extends Annotation> annotation) Returns the value of the first property carrying the given annotation, ornullwhen the target, annotated property, or property value is absent.static Collection<Object> getAnnotatedPropertyValues(Object target, Class<? extends Annotation> annotation) Reads all matching annotated properties and returns their non-null values; a null target yields an empty collection.static <A extends Annotation>
Optional<A> getAnnotation(AnnotatedElement m, Class<A> a) Returns a direct or composed annotation, using inherited method and type lookup where applicable.static <T> Optional<T> getAnnotationAs(Annotation annotation, Class<? extends Annotation> targetAnnotation, Class<? extends T> returnType) Returns the annotation or its matching meta-annotation whenreturnTypeis the target annotation type.static <T> Optional<T> getAnnotationAs(Class<?> target, Class<? extends Annotation> annotationType, Class<T> returnType) Finds a matching type annotation and projects its attributes into the requested representation; null or unmatched targets yield an empty optional.static <T> Optional<T> getAnnotationAs(AnnotatedElement member, Class<? extends Annotation> annotationType, Class<? extends T> returnType) Finds a matching annotation on the element and projects its attributes into the requested representation, or returns an empty optional if absent.static <T> Optional<T> getAnnotationAttribute(Annotation annotation, String name, Class<T> expectedType) Returns a single annotation attribute value when it exists and matches the requested type.getAnnotationAttributes(Annotation annotation) Returns all no-argument attributes declared by an annotation instance.static List<Annotation> getAnnotations(AnnotatedElement element) Returns the direct annotations present on an annotated element.static Class<?> Returns the first calling class outside the immediate invoking class andjava.*, or null if none is found.getCollectionElementType(AccessibleObject fieldOrMethod) Resolves the collection element or map value class from a field or method's generic type.getCollectionElementType(Type parameterizedType) Resolves the first generic argument, or the value argument for maps, using a wildcard's upper bound.static Optional<Constructor<?>> getDefaultConstructor(Class<?> type) Returns the default constructor declared by the supplied type, if present.static Class<?> getEnclosingClass(AccessibleObject fieldOrMethod) Returns the class declaring the member; rejects accessible objects that do not represent a member.Returns the first discovered field with the given name, including inherited fields.static <A extends Annotation>
Optional<A> getFieldAnnotation(Field f, Class<? extends Annotation> a) Returns the field's direct or composed annotation, if present; composed matches retain the outer annotation instance.static <T> Optional<T> getFieldValue(String fieldName, Object target) Reads a named field with reflective access enabled, returning an empty optional for a null target, missing field, or null value.static <T extends Type>
TgetFirstTypeArgument(Type genericType) Returns the first actual generic argument.static TypegetGenericPropertyType(AccessibleObject fieldOrMethod) Returns a field's generic type or a method's generic return type; rejects other accessible objects.static TypegetGenericType(Class<?> candidate, Class<?> wantedClass) Resolves the requested supertype's generic arguments in the context of the candidate class.static TypegetGenericType(Type candidate, Class<?> wantedClass) Resolves a generic supertype from a parameterized declaration, preserving its argument bindings.static <A extends Annotation>
Optional<A> getMemberAnnotation(Class<?> type, String memberName, Class<? extends Annotation> a) Finds an annotation on a method with the supplied name, falling back to a case-insensitive field-name match with an optional getter prefix removed.Returns the first discovered method with the given name; parameter types are not used to select an overload.static <A extends Annotation>
Optional<A> getMethodAnnotation(Executable m, Class<? extends Annotation> a) Returns the first matching direct or composed annotation in the executable's override hierarchy.static <A extends Annotation>
List<A> getMethodAnnotations(Executable m, Class<? extends Annotation> a) Returns matching annotations from the first declaration in the override hierarchy that supplies them.getMethodOverrideHierarchy(Method method) Returns the method followed by the superclass and interface methods it overrides, without duplicates.static StringgetName(AccessibleObject fieldOrMethod) Returns the member name; rejects accessible objects that do not represent a member.Returns the package and the parent packages that can be resolved for its name.static <A extends Annotation>
Optional<A> getPackageAnnotation(Package p, Class<A> annotationType) Returns the requested annotation from the package or its enclosing package hierarchy, if present.static Collection<? extends Annotation> Returns package annotations, including those discovered recursively on enclosing packages.static Collection<? extends Annotation> getPackageAnnotations(Package p, boolean recursive) Returns package annotations, optionally including enclosing packages whenrecursiveis true.static intgetParameterIndex(Parameter parameter) Returns the zero-based position of the parameter in its declaring executable.getParameterOverrideHierarchy(Parameter parameter) Returns the parameter at the same position throughout its method's override hierarchy, or just the supplied constructor parameter.static <T> Optional<T> getPropertyAnnotation(String propertyPath, Object target) Reads the value at a property path, returning an empty optional for a null target, missing property, or null value, including missing JSON fields and explicit JSON nulls.static StringgetPropertyName(AccessibleObject property) Returns a field name or derives a property name from a method, stripping conventionalgetandisprefixes.getPropertyPathMetadata(Class<?> target, String propertyPath) Returns structural metadata for a nested property path; a null type or null or empty path yields missing metadata.static Class<?> getPropertyType(AccessibleObject fieldOrMethod) Returns a field's declared type or a method's return type; rejects other accessible objects.Returns the loadable types from the generated application type registry.static StringgetSimpleName(Class<?> c) Returns the class name after its last package or nested-class separator.static StringReturns the final component of the package name.static StringgetSimpleName(String fullyQualifiedName) Returns the name after the last dot or dollar separator; null or blank names are rejected.static <A extends Annotation>
AgetTypeAnnotation(Class<?> type, Class<? extends Annotation> annotationType) Finds a direct or composed type annotation, falling back to enclosing classes; returns null if absent.static Collection<? extends Annotation> getTypeAnnotations(Class<?> type) Returns the cached annotations on the type and its interfaces, deduplicated by annotation type.static <T extends Type>
TgetTypeArgument(Type genericType, int index) Returns the actual generic argument at the zero-based index.getTypeArguments(Type genericType) Returns actual generic arguments for a parameterized type, or an empty list for a raw type.static ReflectionUtils.TypeMetadatagetTypeMetadata(@NonNull Class<?> type) Returns the shared, class-scoped structural metadata for the given type.static ObjectgetValue(AccessibleObject fieldOrMethod, Object target) Reads a field or invokes a property method with reflective access enabled.static ObjectgetValue(AccessibleObject fieldOrMethod, Object target, boolean forceAccess) Reads a field or invokes a property method on the target.static booleanhas(Class<? extends Annotation> annotationClass, Method method) Returns whether the method or an overridden declaration has the requested direct or composed annotation.static booleanhas(Class<? extends Annotation> annotationClass, Parameter parameter) Returns whether the parameter directly carries the annotation or a composed annotation of that type.static booleanhasNonDefaultAnnotationAttribute(Annotation annotation, String name) Returns whether an annotation attribute has a value that differs from its declared default.static booleanhasProperty(String propertyPath, Object target) Returns whether the property path can be read, including a property whose value is null.static booleanhasReturnType(Executable executable) Returns whether the executable produces a result: constructors and methods whose return type is notvoiddo.static Class<?> static booleanisAnnotationPresent(Class<?> type, Class<? extends Annotation> annotationType) Returns whether the type, its interfaces, or an enclosing class supplies a matching annotation.static booleanisAnnotationPresent(Parameter parameter, Class<? extends Annotation> annotationType) Returns whether the parameter has a direct or composed annotation of the requested type.static booleanReturns whether the value represents a Java class or a supported Kotlin class literal.static booleanisKotlinDataClassComponent(Method method) Whether a no-argument method is a compiler-generated Kotlin data-class component accessor.static booleanReturns whether the optional Kotlin reflection implementation is available on the classpath.static booleanisLeafValue(Object value) Returns whether the given value should be treated as a terminal scalar during reflective traversal.static booleanisMethodAnnotationPresent(Executable method, Class<? extends Annotation> annotation) Returns whether an executable has a matching direct, meta-, or inherited method annotation.static booleanisNullable(Parameter parameter) Returns whether a parameter or an overridden declaration allows null according to nullable annotations or available Kotlin metadata.static booleanisOrHas(Annotation annotation, Class<? extends Annotation> annotationType) Returns whether an annotation is of the requested type or directly carries that type as a meta-annotation.static booleanisOrHas(Class<?> type, Class<? extends Annotation> annotationType) Returns whether the class is the requested annotation type or directly carries that annotation; null returns false.static booleanisStatic(Executable method) Returns whether the executable has the Javastaticmodifier.static Class<?> loadClassWithoutInitialization(String binaryName, ClassLoader classLoader) Loads an exact binary class name without executing its static initializer or resolving serialization aliases.static Class<?> static <T> Optional<T> readProperty(String propertyPath, Object target) Reads a nested property path.static StringResolves a unique registered simple or partial name to its class name.static voidAssigns the field with reflective access enabled; access and assignment failures propagate.static voidAssigns a field declared directly on the target's class, with reflective access enabled.static Class<?> Converts a primitive wrapper type to its primitive class and leaves other types unchanged.static voidwriteProperty(String propertyPath, Object target, Object value) Writes a nested property if the target and property exist.
-
Constructor Details
-
ReflectionUtils
public ReflectionUtils()
-
-
Method Details
-
getMethodOverrideHierarchy
-
getParameterOverrideHierarchy
-
isKotlinReflectionSupported
public static boolean isKotlinReflectionSupported()Returns whether the optional Kotlin reflection implementation is available on the classpath. -
isKotlinDataClassComponent
Whether a no-argument method is a compiler-generated Kotlin data-class component accessor. These duplicate constructor properties and should not be inferred as additional domain properties. Handwritten component methods and ordinary Java methods are not excluded. -
ifClass
-
isClass
Returns whether the value represents a Java class or a supported Kotlin class literal. -
asClass
-
getTypeMetadata
Returns the shared, class-scoped structural metadata for the given type. -
getAllMethods
-
getDefaultConstructor
Returns the default constructor declared by the supplied type, if present. -
getAllInterfaces
-
box
-
unbox
-
rawClass
-
getMethod
-
getAnnotatedProperties
public static List<? extends AccessibleObject> getAnnotatedProperties(Class<?> target, Class<? extends Annotation> annotation) Returns annotated fields and readable methods, deduplicated by property name, including inherited and meta-annotated properties. -
getAnnotatedProperty
public static Optional<? extends AccessibleObject> getAnnotatedProperty(Object target, Class<? extends Annotation> annotation) Returns the first matching annotated property on the target or represented class, or an empty optional for a null target. -
getAnnotatedProperty
public static Optional<? extends AccessibleObject> getAnnotatedProperty(Class<?> target, Class<? extends Annotation> annotation) Returns the first annotated property discovered for the type, or an empty optional when none matches. -
getAnnotatedPropertyInvoker
public static Optional<MemberInvoker> getAnnotatedPropertyInvoker(Class<?> target, Class<? extends Annotation> annotation) Returns a cached invoker for the first matching annotated property, with reflective access enabled. -
getPropertyPathMetadata
public static ReflectionUtils.TypeMetadata.PropertyPathMetadata getPropertyPathMetadata(Class<?> target, String propertyPath) Returns structural metadata for a nested property path; a null type or null or empty path yields missing metadata. -
getAnnotatedPropertyValue
public static Optional<Object> getAnnotatedPropertyValue(Object target, Class<? extends Annotation> annotation) Reads the first matching annotated property, returning an empty optional for a missing or null value. -
getAnnotatedPropertyValueOrNull
public static Object getAnnotatedPropertyValueOrNull(Object target, Class<? extends Annotation> annotation) Returns the value of the first property carrying the given annotation, ornullwhen the target, annotated property, or property value is absent.This is the allocation-free counterpart of
getAnnotatedPropertyValue(Object, Class)for callers that already usenullas their absence sentinel. It uses the same centrally cachedReflectionUtils.TypeMetadataand compiledMemberInvoker.- Parameters:
target- target object, ornullannotation- annotation that identifies the property- Returns:
- the property value, or
nullwhen absent
-
getAnnotatedPropertyValues
public static Collection<Object> getAnnotatedPropertyValues(Object target, Class<? extends Annotation> annotation) Reads all matching annotated properties and returns their non-null values; a null target yields an empty collection. -
getAnnotatedPropertyName
public static Optional<String> getAnnotatedPropertyName(Object target, Class<? extends Annotation> annotation) Returns the logical name of the first matching annotated property, if present. -
getPropertyName
Returns a field name or derives a property name from a method, stripping conventionalgetandisprefixes. -
getAnnotatedMethods
public static List<Method> getAnnotatedMethods(Class<?> target, Class<? extends Annotation> annotation) Returns discovered methods carrying the annotation directly, through a meta-annotation, or through an overridden declaration. -
getAnnotatedMethods
public static List<Method> getAnnotatedMethods(Object target, Class<? extends Annotation> annotation) Returns matching annotated methods on the target's runtime class, or an empty list for a null target. -
isMethodAnnotationPresent
public static boolean isMethodAnnotationPresent(Executable method, Class<? extends Annotation> annotation) Returns whether an executable has a matching direct, meta-, or inherited method annotation. -
getAnnotatedFields
public static List<Field> getAnnotatedFields(Class<?> target, Class<? extends Annotation> annotation) Returns discovered fields carrying the annotation directly or through a meta-annotation. -
getAnnotatedFields
Returns matching annotated fields on the target or represented class, or an empty list for a null target. -
isAnnotationPresent
public static boolean isAnnotationPresent(Class<?> type, Class<? extends Annotation> annotationType) Returns whether the type, its interfaces, or an enclosing class supplies a matching annotation. -
getTypeAnnotation
public static <A extends Annotation> A getTypeAnnotation(Class<?> type, Class<? extends Annotation> annotationType) Finds a direct or composed type annotation, falling back to enclosing classes; returns null if absent. For a composed annotation, the returned instance is the outer annotation. -
getTypeAnnotations
Returns the cached annotations on the type and its interfaces, deduplicated by annotation type. -
getAnnotations
Returns the direct annotations present on an annotated element.For type, field, method, constructor, and parameter elements, the result is cached in the declaring
ReflectionUtils.TypeMetadata. UsegetTypeAnnotations(Class)when inherited Fluxzero type annotation semantics are needed, andgetPackageAnnotations(Package)for recursive package annotation lookup.- Parameters:
element- the annotated element to inspect- Returns:
- annotations present on the element, or an empty list when
elementisnull
-
getPackageAnnotation
public static <A extends Annotation> Optional<A> getPackageAnnotation(Package p, Class<A> annotationType) Returns the requested annotation from the package or its enclosing package hierarchy, if present. -
getPackageAnnotations
Returns package annotations, including those discovered recursively on enclosing packages. -
getPackageAnnotations
Returns package annotations, optionally including enclosing packages whenrecursiveis true. -
readProperty
-
getTypeArguments
-
getFirstTypeArgument
Returns the first actual generic argument. A raw type is rejected withIllegalArgumentException. -
getTypeArgument
Returns the actual generic argument at the zero-based index. A raw type is rejected withIllegalArgumentException. -
getPropertyAnnotation
Reads the value at a property path, returning an empty optional for a null target, missing property, or null value, including missing JSON fields and explicit JSON nulls. Despite its name, this method reads a value rather than annotation metadata. -
hasProperty
-
hasReturnType
Returns whether the executable produces a result: constructors and methods whose return type is notvoiddo. -
getFieldValue
-
getValue
Reads a field or invokes a property method on the target.forceAccesscontrols whether Java access checks are suppressed where permitted. -
getValue
Reads a field or invokes a property method with reflective access enabled. -
getName
Returns the member name; rejects accessible objects that do not represent a member. -
getEnclosingClass
Returns the class declaring the member; rejects accessible objects that do not represent a member. -
getPropertyType
Returns a field's declared type or a method's return type; rejects other accessible objects. -
getGenericPropertyType
Returns a field's generic type or a method's generic return type; rejects other accessible objects. -
writeProperty
-
isOrHas
Returns whether an annotation is of the requested type or directly carries that type as a meta-annotation. -
isOrHas
Returns whether the class is the requested annotation type or directly carries that annotation; null returns false. -
getField
-
getCallerClass
Returns the first calling class outside the immediate invoking class andjava.*, or null if none is found. -
isNullable
Returns whether a parameter or an overridden declaration allows null according to nullable annotations or available Kotlin metadata. -
asInstance
Instantiates a Java or supported Kotlin class literal using its no-argument constructor; returns ordinary instances unchanged. Construction failures are wrapped inIllegalStateException. -
getParameterIndex
Returns the zero-based position of the parameter in its declaring executable. -
determineCommonAncestors
Returns common ancestor types for the runtime classes of the elements, treating null elements asVoid. -
getPackageAndParentPackages
-
getMemberAnnotation
public static <A extends Annotation> Optional<A> getMemberAnnotation(Class<?> type, String memberName, Class<? extends Annotation> a) Finds an annotation on a method with the supplied name, falling back to a case-insensitive field-name match with an optional getter prefix removed. -
isStatic
Returns whether the executable has the Javastaticmodifier. -
isLeafValue
Returns whether the given value should be treated as a terminal scalar during reflective traversal.Leaf values are not recursively inspected for nested annotated properties. This is used by infrastructure such as search indexing and data protection to decide whether a value should be processed as a whole or traversed further.
A value is considered a leaf when it is:
null- one of the built-in scalar types known to Fluxzero, such as strings, numbers, booleans, temporal values, URIs, locales, and similar primitives/value objects
- an enum
- an instance of a type implementing
Leaf
- Parameters:
value- the value to inspect- Returns:
trueif the value should be treated as a leaf,falseotherwise
-
isAnnotationPresent
public static boolean isAnnotationPresent(Parameter parameter, Class<? extends Annotation> annotationType) Returns whether the parameter has a direct or composed annotation of the requested type. -
getGenericType
-
getGenericType
-
getCollectionElementType
Resolves the collection element or map value class from a field or method's generic type. -
getCollectionElementType
-
declaresField
-
setField
-
setField
-
ensureAccessible
Enables reflective access to the member and returns it; platform access restrictions can still reject the operation. -
getAnnotationAttributes
Returns all no-argument attributes declared by an annotation instance.- Parameters:
annotation- the annotation to inspect- Returns:
- annotation attribute values keyed by attribute name
-
getAnnotationAttribute
public static <T> Optional<T> getAnnotationAttribute(Annotation annotation, String name, Class<T> expectedType) Returns a single annotation attribute value when it exists and matches the requested type.- Type Parameters:
T- attribute value type- Parameters:
annotation- the annotation to inspectname- the attribute nameexpectedType- the expected attribute value type- Returns:
- the attribute value, or empty if the attribute is absent or has another type
-
hasNonDefaultAnnotationAttribute
Returns whether an annotation attribute has a value that differs from its declared default.- Parameters:
annotation- the annotation to inspectname- the attribute name- Returns:
trueif the attribute has a default and the actual value differs from it
-
getAnnotation
Returns a direct or composed annotation, using inherited method and type lookup where applicable. -
getAnnotationAs
public static <T> Optional<T> getAnnotationAs(Class<?> target, Class<? extends Annotation> annotationType, Class<T> returnType) Finds a matching type annotation and projects its attributes into the requested representation; null or unmatched targets yield an empty optional. -
getAnnotationAs
public static <T> Optional<T> getAnnotationAs(AnnotatedElement member, Class<? extends Annotation> annotationType, Class<? extends T> returnType) Finds a matching annotation on the element and projects its attributes into the requested representation, or returns an empty optional if absent. -
getAnnotationAs
public static <T> Optional<T> getAnnotationAs(Annotation annotation, Class<? extends Annotation> targetAnnotation, Class<? extends T> returnType) Returns the annotation or its matching meta-annotation whenreturnTypeis the target annotation type. For maps and converted objects, merges meta-annotation defaults with the outer annotation's attributes, which take precedence. A null annotation or target annotation type yields an empty optional. -
convertAnnotation
Converts the annotation's attributes into the requested representation. -
has
Returns whether the method or an overridden declaration has the requested direct or composed annotation. -
has
Returns whether the parameter directly carries the annotation or a composed annotation of that type. -
getFieldAnnotation
public static <A extends Annotation> Optional<A> getFieldAnnotation(Field f, Class<? extends Annotation> a) Returns the field's direct or composed annotation, if present; composed matches retain the outer annotation instance. -
getMethodAnnotation
public static <A extends Annotation> Optional<A> getMethodAnnotation(Executable m, Class<? extends Annotation> a) Returns the first matching direct or composed annotation in the executable's override hierarchy. -
getMethodAnnotations
public static <A extends Annotation> List<A> getMethodAnnotations(Executable m, Class<? extends Annotation> a) Returns matching annotations from the first declaration in the override hierarchy that supplies them. -
copyFields
public static <V> V copyFields(V source, V target) Copies all non-static fields between objects of the same runtime class and returns the target. Null inputs leave the target unchanged; arrays return the source instead of copying elements. -
classForName
Resolves a class name through the SDK's class lookup; throwsClassNotFoundExceptionif unresolved. -
classForName
-
classExists
Returns whether the SDK's class lookup can resolve the supplied class name. -
resolveRegisteredTypeName
Resolves a unique registered simple or partial name to its class name. Canonical names, unknown identifiers,nulland generic signatures are returned unchanged. Generic signatures do not initiate class loading. Name normalization shares the class-lookup cache; it never caches application-specific serialization aliases.- Parameters:
name- the serialized type identifier- Returns:
- its uniquely registered class name, or the original identifier if no normalization is needed
-
getSimpleName
-
getSimpleName
-
getSimpleName
-
getRegisteredTypes
Returns the loadable types from the generated application type registry.The result is resolved once and uses the same class cache as
classForName(String). -
loadClassWithoutInitialization
public static Class<?> loadClassWithoutInitialization(String binaryName, ClassLoader classLoader) throws ClassNotFoundException Loads an exact binary class name without executing its static initializer or resolving serialization aliases. Uses the supplied index-owning classloader. Intended for generated structural indexes; the JVM owns class identity andgetTypeMetadata(Class)owns subsequent structural reflection.- Throws:
ClassNotFoundException- when the named class is unavailable
-