Package net.bytebuddy.description.type
Class RecordComponentDescription.ForLoadedRecordComponent.Dispatcher.ForJava14CapableVm
- java.lang.Object
-
- net.bytebuddy.description.type.RecordComponentDescription.ForLoadedRecordComponent.Dispatcher.ForJava14CapableVm
-
- All Implemented Interfaces:
RecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Enclosing interface:
- RecordComponentDescription.ForLoadedRecordComponent.Dispatcher
@Enhance public static class RecordComponentDescription.ForLoadedRecordComponent.Dispatcher.ForJava14CapableVm extends Object implements RecordComponentDescription.ForLoadedRecordComponent.Dispatcher
A dispatcher for a Java 14-capable JVM.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.type.RecordComponentDescription.ForLoadedRecordComponent.Dispatcher
RecordComponentDescription.ForLoadedRecordComponent.Dispatcher.CreationAction, RecordComponentDescription.ForLoadedRecordComponent.Dispatcher.ForJava14CapableVm, RecordComponentDescription.ForLoadedRecordComponent.Dispatcher.ForLegacyVm
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForJava14CapableVm(Class<?> recordComponent, Method getRecordComponents, Method isRecord, Method getName, Method getDeclaringType, Method getAccessor, Method getType, Method getGenericType, Method getGenericSignature, Method getAnnotatedType)
Creates a dispatcher for a Java 14 capable VM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Method
getAccessor(Object recordComponent)
Resolves a record component's accessor method.AnnotatedElement
getAnnotatedType(Object recordComponent)
Resolves a record component's annotated type.Class<?>
getDeclaringType(Object recordComponent)
Resolves a record component's declaring type.String
getGenericSignature(Object recordComponent)
Returns the record component type's generic signature.Type
getGenericType(Object recordComponent)
Resolves a record component's generic type.String
getName(Object recordComponent)
Resolves a record component's name.Object[]
getRecordComponents(Class<?> type)
Resolves a type's record components.Class<?>
getType(Object recordComponent)
Resolves a record component's type.boolean
isInstance(Object instance)
Checks if the supplied instance is a record component.boolean
isRecord(Class<?> type)
Checks if the supplied type is a record.
-
-
-
Constructor Detail
-
ForJava14CapableVm
protected ForJava14CapableVm(Class<?> recordComponent, Method getRecordComponents, Method isRecord, Method getName, Method getDeclaringType, Method getAccessor, Method getType, Method getGenericType, Method getGenericSignature, Method getAnnotatedType)
Creates a dispatcher for a Java 14 capable VM.- Parameters:
recordComponent
- Thejava.lang.reflect.RecordComponent
type.getRecordComponents
- Thejava.lang.Class#getRecordComponents()
method.isRecord
- Thejava.lang.Class#isRecord()
method.getName
- Thejava.lang.reflect.RecordComponent#getName()
method.getDeclaringType
- Thejava.lang.reflect.RecordComponent#getDeclaringType()
method.getAccessor
- Thejava.lang.reflect.RecordComponent#getAccessor()
method.getType
- Thejava.lang.reflect.RecordComponent#getType()
method.getGenericType
- Thejava.lang.reflect.RecordComponent#getGenericType()
method.getGenericSignature
- Thejava.lang.reflect.RecordComponent#getGenericSignature()
method.getAnnotatedType
- Thejava.lang.reflect.RecordComponent#getAnnotatedType()
method.
-
-
Method Detail
-
isInstance
public boolean isInstance(Object instance)
Checks if the supplied instance is a record component.- Specified by:
isInstance
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
instance
- The instance to evaluate.- Returns:
true
if the supplied instance is a record component.
-
getRecordComponents
public Object[] getRecordComponents(Class<?> type)
Resolves a type's record components.- Specified by:
getRecordComponents
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
type
- The type for which to read the record components.- Returns:
- An array of all declared record components.
-
isRecord
public boolean isRecord(Class<?> type)
Checks if the supplied type is a record.- Specified by:
isRecord
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
type
- The type to resolve.- Returns:
true
if the supplied type is a record.
-
getName
public String getName(Object recordComponent)
Resolves a record component's name.- Specified by:
getName
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
recordComponent
- The record component to resolve the name for.- Returns:
- The record component's name.
-
getDeclaringType
public Class<?> getDeclaringType(Object recordComponent)
Resolves a record component's declaring type.- Specified by:
getDeclaringType
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
recordComponent
- The record component to resolve the declared type for.- Returns:
- The record component's declaring type.
-
getAccessor
public Method getAccessor(Object recordComponent)
Resolves a record component's accessor method.- Specified by:
getAccessor
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
recordComponent
- The record component to resolve the accessor method for.- Returns:
- The record component's accessor method.
-
getType
public Class<?> getType(Object recordComponent)
Resolves a record component's type.- Specified by:
getType
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
recordComponent
- The record component to resolve the type for.- Returns:
- The record component's type.
-
getGenericType
public Type getGenericType(Object recordComponent)
Resolves a record component's generic type.- Specified by:
getGenericType
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
recordComponent
- The record component to resolve the generic type for.- Returns:
- The record component's generic type.
-
getGenericSignature
public String getGenericSignature(Object recordComponent)
Returns the record component type's generic signature.- Specified by:
getGenericSignature
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
recordComponent
- The record component to resolve the generic signature for.- Returns:
- The record component type's generic signature or
null
if no signature is defined.
-
getAnnotatedType
public AnnotatedElement getAnnotatedType(Object recordComponent)
Resolves a record component's annotated type.- Specified by:
getAnnotatedType
in interfaceRecordComponentDescription.ForLoadedRecordComponent.Dispatcher
- Parameters:
recordComponent
- The record component to resolve the annotated type for.- Returns:
- The record component's annotated type.
-
-