Package io.aether.utils
Interface CTypeI<T>
-
- Type Parameters:
T- the type represented by this instance
- All Superinterfaces:
ToString
- All Known Implementing Classes:
CType,CType.WType
public interface CTypeI<T> extends ToString
Interface representing a type with additional metadata and utility methods. Provides methods for type inspection, manipulation, and comparison.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceCTypeI.CompareEventInterface for comparison events.static interfaceCTypeI.FieldAccessor<T2>Interface for field access operations.
-
Field Summary
Fields Modifier and Type Field Description static CTypeI<java.lang.Boolean>BOOLEANstatic CTypeI<boolean[]>BOOLEAN_ARRstatic CTypeI<java.lang.Boolean>BOOLEAN_BOXstatic CTypeI<java.lang.Byte>BYTEstatic CTypeI<byte[]>BYTE_ARRstatic CTypeI<java.lang.Byte>BYTE_BOXstatic CTypeI<java.lang.Character>CHARstatic CTypeI<java.lang.Character>CHAR_BOXstatic java.lang.StringCLASS_NAMEstatic CTypeI<java.lang.Double>DOUBLEstatic CTypeI<double[]>DOUBLE_ARRstatic CTypeI<java.lang.Double>DOUBLE_BOXstatic CTypeI<java.lang.Float>FLOATstatic CTypeI<float[]>FLOAT_ARRstatic CTypeI<java.lang.Float>FLOAT_BOXstatic CTypeI<java.lang.Integer>INTstatic CTypeI<int[]>INT_ARRstatic CTypeI<java.lang.Integer>INT_BOXstatic CTypeI<java.lang.Long>LONGstatic CTypeI<long[]>LONG_ARRstatic CTypeI<java.lang.Long>LONG_BOXstatic CTypeI<java.lang.Short>SHORTstatic CTypeI<short[]>SHORT_ARRstatic CTypeI<java.lang.Short>SHORT_BOXstatic CTypeI<java.lang.String>STRINGstatic CTypeI<java.lang.Byte>UBYTEstatic CTypeI<java.lang.Integer>UINTstatic CTypeI<java.lang.Long>ULONGstatic jdk.jfr.UnsignedUNSIGNEDstatic CTypeI<java.lang.Short>USHORT
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description CTypeI<T>addAnnotations(java.lang.annotation.Annotation... aa)Adds annotations to this type and returns a new type instance with the annotations.static <T extends java.lang.annotation.Annotation>
Tannotation(java.lang.Class<T> type, java.util.Map<java.lang.String,java.lang.Object> args)Creates an annotation instance of the specified type with the given values.static java.lang.StringannotationToBuildCode(java.lang.annotation.Annotation a)Converts an annotation to its build code representation.static voidannotationToBuildCode(java.lang.StringBuilder sb, java.lang.annotation.Annotation a)Appends the build code representation of an annotation to the specified string builder.static java.lang.StringannotationToCode(java.lang.annotation.Annotation a)Converts an annotation to its code representation.static voidannotationToCode(java.lang.StringBuilder sb, java.lang.annotation.Annotation a)Appends the code representation of an annotation to the specified string builder.static CTypeI<java.lang.Object>buildArray(CTypeI<java.lang.Object> component, java.lang.annotation.Annotation[] annotations)Creates an array type for the specified component type with annotations.static <T> CTypeI<T[]>buildArray(CTypeI<T> component)Creates an array type for the specified component type.static <T> CTypeI<T[]>buildArray(java.lang.reflect.AnnotatedType component, java.lang.annotation.Annotation[] annotations)Creates an array type for the specified component type with annotations.static <T> CTypeI<T[]>buildArray(java.lang.reflect.Type component)Creates an array type for the specified component type.<C> CTypeI<C>cast()Casts this type to the specified type.Tcast(java.lang.Object o)Casts the specified object to this type.booleancompareValues(T val1, T val2, CTypeI.CompareEvent consumer)Compares two values of this type, potentially using custom comparison logic.java.lang.StringdeclareCode()Gets the declaration code for this type, including annotations and type parameters.static Flow<java.lang.annotation.Annotation>getAllAnnotations(java.lang.Class<?> type)Gets a flow of all annotations on the specified type and its parents.Flow<CTypeI<? extends T>>getAllChildrenClasses()Gets all children classes of this type, including nested subclasses.voidgetAllDependencies(java.util.Set<CTypeI<?>> res, boolean withTransient)Collects all dependencies of this type.Flow<java.lang.reflect.Field>getAllFields()Gets all fields of this type, including inherited ones.static voidgetAllFields(java.lang.Class<?> raw, java.util.List<java.lang.reflect.Field> res)Collects all fields (including inherited) for the specified class.Flow<java.lang.reflect.Method>getAllMethods()Gets all methods of this type, including inherited ones.static voidgetAllMethods(java.lang.Class<?> raw, java.util.Set<java.lang.reflect.Method> res)Collects all methods (including inherited) for the specified class.static Flow<java.lang.Class<?>>getAllParentClasses(java.lang.Class<?> type)Gets a flow of all parent classes and interfaces for the specified type.<A extends java.lang.annotation.Annotation>
AgetAnnotation(java.lang.Class<A> aClass)Gets the specified annotation if present on this type.java.lang.annotation.Annotation[]getAnnotations()Gets all annotations on this type.java.lang.StringgetCanonicalName()Gets the canonical name of this type.java.lang.CharSequencegetCanonicalNameWithParameters()Gets the canonical name of the type with type parameters.voidgetCanonicalNameWithParameters(AString sb)Appends the canonical name of the type with type parameters to the specified string builder.CTypeI<? extends T>[]getChildrenClasses()Gets the permitted subclasses for this sealed type.java.lang.ClassLoadergetClassLoader()Gets the class loader associated with this type.CTypeI<java.lang.Object>getComponent()Gets the component type for array types.CTypeI<java.lang.Object>getComponent(int i)Gets the component type at the specified index.CTypeI<java.lang.Object>getComponent(java.lang.Class<?> base, int i)Gets the component type for the specified base class and index.CTypeI<java.lang.Object>getComponentByName(java.lang.String name)Gets the component type by name for parameterized types.java.lang.reflect.Constructor<?>getConstructor(java.lang.Class<?>... args)Gets the constructor with the specified parameter types.static java.lang.reflect.Constructor<?>getDefaultConstructor(java.lang.Class<?> c)Gets the default (no-arg) constructor for the specified class.java.lang.Enum<?>[]getEnumValues()Gets the enum values if this type represents an enum.<FT> CTypeI.FieldAccessor<FT>getFieldAccessor(java.lang.reflect.Field field)Gets a field accessor for the specified field.<FT> CTypeI.FieldAccessor<FT>getFieldAccessor(java.lang.String field)Gets a field accessor for the specified field name.Flow<java.lang.reflect.Field>getFields()Gets all declared fields of this type.java.lang.invoke.VarHandlegetFieldVarHandle(java.lang.reflect.Field field)Gets a VarHandle for the specified field.java.lang.invoke.VarHandlegetFieldVarHandle(java.lang.String name)Gets a VarHandle for the field with the specified name.java.lang.reflect.TypeVariable<?>[]getGenericVariables()Gets the type variables for generic types.Flow<CTypeI<?>>getInterfaces()Gets all interfaces implemented by this type.Flow<java.lang.reflect.Method>getMethods()Gets all declared methods of this type.java.lang.StringgetPackage()Gets the package name for this type.CTypeI<java.lang.Object>[]getParameters()Gets the type parameters for this type.CTypeI<? super T>getParent()Gets the parent type of this type.java.lang.Class<T>getRaw()Gets the raw class representing this type.java.lang.Class<?>getRaw2()Gets the raw class representing this type (alternative to getRaw).java.lang.StringgetRawSimpleName()Gets the simple name of the raw type.java.lang.StringgetRawSimpleNameWithParameters()Gets the simple name of the raw type with type parameters.voidgetRawSimpleNameWithParameters(AString sb2)Appends the simple name of the raw type with type parameters to the specified string builder.booleaninstanceOf(CTypeI<?> t)Checks if this type is an instance of the specified type.booleaninstanceOf(java.lang.reflect.AnnotatedType t)Checks if this type is an instance of the specified annotated type.booleaninstanceOf(java.lang.reflect.Type t)Checks if this type is an instance of the specified type.booleanisAbstract()Checks if this type is abstract.booleanisAetherClass()Checks if this type is part of the Aether framework.booleanisAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)Checks if this type is annotated with the specified annotation.booleanisArray()Checks if this type represents an array.booleanisBoxedOrRawPrimitive()Checks if this type represents a boxed primitive or raw primitive.booleanisBoxedPrimitive()Checks if this type represents a boxed primitive.booleanisEnum()Checks if this type represents an enum.booleanisInstance(java.lang.Object o)Checks if the specified object is an instance of this type.booleanisInterface()Checks if this type represents an interface.booleanisNumber()Checks if this type represents a number (primitive or boxed).booleanisParameterizedType()Checks if this type is a parameterized type.booleanisParametrizedClass()Checks if this type is a parameterized class.booleanisPrimitive()Checks if this type represents a primitive type.booleanisVariable()Checks if this type is a type variable.TmakeAuto(java.lang.Object... args)Creates a new instance of this type with the specified arguments.ASupplier<?>maker()Gets a supplier that can create instances of this type.java.lang.invoke.MethodHandlemaker(java.lang.Class<?>... args)Gets a MethodHandle for the constructor with the specified parameter types.booleanmutable()Checks if the type is mutable (can be modified after creation).static <T> CTypeI<T>of(java.lang.annotation.Annotation[] aa, CTypeI<T> type)Creates a type instance with the specified annotations and existing type.static CTypeI<java.lang.Object>of(java.lang.annotation.Annotation[] aa, java.lang.Class<?> type, java.lang.reflect.AnnotatedType... args)Creates a type instance with the specified annotations, class, and type arguments.static <T> CTypeI<T>of(java.lang.annotation.Annotation[] aa, java.lang.Class<T> type, java.lang.reflect.Type... args)Creates a type instance with the specified annotations, class, and type arguments.static <T> CTypeI<T>of(java.lang.annotation.Annotation[] aa, java.lang.reflect.Type type)Creates a type instance with the specified annotations and type.static <T> CTypeI<T>of(java.lang.annotation.Annotation aa, java.lang.Class<T> type, java.lang.reflect.AnnotatedType... args)Creates a type instance with the specified annotation, class, and type arguments.static <T> CTypeI<T>of(java.lang.Class<? super T> raw, CTypeI<?>... args)Creates a type instance for the specified raw class and type arguments.static <T> CTypeI<T>of(java.lang.Class<? super T> raw, java.lang.reflect.Type... args)Creates a type instance for the specified raw class and type arguments.static <T> CTypeI<T>of(java.lang.Class<T> type)Creates a type instance for the specified class.static <T> CTypeI<T>of(java.lang.reflect.AnnotatedType type)Creates a type instance for the specified annotated type.static <T> CTypeI<T>of(java.lang.reflect.AnnotatedType raw, CTypeI<java.lang.Object>[] args)Creates a type instance for the specified raw annotated type and type arguments.static <T> CTypeI<T>of(java.lang.reflect.AnnotatedType raw, java.lang.reflect.AnnotatedType[] args)Creates a type instance for the specified raw annotated type and type arguments.static <T> CTypeI<T>of(java.lang.reflect.Type type)Creates a type instance for the specified type.static <T> CTypeI<T>of(java.lang.reflect.Type res, java.util.List<java.lang.reflect.Type> pp)Creates a type instance for the specified type and parameters.CTypeI<?>resolveExtend(CTypeI<java.lang.Object> inf)Resolves the extended type for the specified interface in the context of this type.CTypeI<?>resolveReturnType(java.lang.reflect.Method m)Resolves the return type of the specified method in the context of this type.CTypeI<?>[]resolveTypeArgs(java.lang.reflect.Method m)Resolves the type arguments of the specified method in the context of this type.CTypeI<?>resolveTypeField(java.lang.reflect.Field f)Resolves the type of the specified field in the context of this type.@NotNull java.lang.reflect.AnnotatedTypetoAnnotatedType()Converts this type to an AnnotatedType object.CTypeI<T[]>toArray()Converts this type to an array type.java.lang.StringtoId()Gets a unique identifier for this type.CTypeI<T>toPrimitive()Converts this type to its primitive equivalent if it's a boxed primitive.@NotNull java.lang.reflect.TypetoType()Converts this type to a standard Type object.CTypeI<T>tryToBox()Attempts to box this type if it's a primitive.CTypeI<T>unbox()Unboxes this type if it's a boxed primitive.
-
-
-
Field Detail
-
UNSIGNED
static final jdk.jfr.Unsigned UNSIGNED
-
UBYTE
static final CTypeI<java.lang.Byte> UBYTE
-
USHORT
static final CTypeI<java.lang.Short> USHORT
-
UINT
static final CTypeI<java.lang.Integer> UINT
-
ULONG
static final CTypeI<java.lang.Long> ULONG
-
CLASS_NAME
static final java.lang.String CLASS_NAME
-
STRING
static final CTypeI<java.lang.String> STRING
-
CHAR
static final CTypeI<java.lang.Character> CHAR
-
CHAR_BOX
static final CTypeI<java.lang.Character> CHAR_BOX
-
BOOLEAN
static final CTypeI<java.lang.Boolean> BOOLEAN
-
BOOLEAN_BOX
static final CTypeI<java.lang.Boolean> BOOLEAN_BOX
-
BYTE
static final CTypeI<java.lang.Byte> BYTE
-
BYTE_BOX
static final CTypeI<java.lang.Byte> BYTE_BOX
-
SHORT
static final CTypeI<java.lang.Short> SHORT
-
SHORT_BOX
static final CTypeI<java.lang.Short> SHORT_BOX
-
INT
static final CTypeI<java.lang.Integer> INT
-
INT_BOX
static final CTypeI<java.lang.Integer> INT_BOX
-
LONG
static final CTypeI<java.lang.Long> LONG
-
LONG_BOX
static final CTypeI<java.lang.Long> LONG_BOX
-
FLOAT
static final CTypeI<java.lang.Float> FLOAT
-
FLOAT_BOX
static final CTypeI<java.lang.Float> FLOAT_BOX
-
DOUBLE
static final CTypeI<java.lang.Double> DOUBLE
-
DOUBLE_BOX
static final CTypeI<java.lang.Double> DOUBLE_BOX
-
BYTE_ARR
static final CTypeI<byte[]> BYTE_ARR
-
BOOLEAN_ARR
static final CTypeI<boolean[]> BOOLEAN_ARR
-
SHORT_ARR
static final CTypeI<short[]> SHORT_ARR
-
INT_ARR
static final CTypeI<int[]> INT_ARR
-
LONG_ARR
static final CTypeI<long[]> LONG_ARR
-
FLOAT_ARR
static final CTypeI<float[]> FLOAT_ARR
-
DOUBLE_ARR
static final CTypeI<double[]> DOUBLE_ARR
-
-
Method Detail
-
mutable
boolean mutable()
Checks if the type is mutable (can be modified after creation).- Returns:
- true if the type is mutable, false otherwise
-
getFieldAccessor
<FT> CTypeI.FieldAccessor<FT> getFieldAccessor(java.lang.String field)
Gets a field accessor for the specified field name.- Type Parameters:
FT- the field type- Parameters:
field- the name of the field- Returns:
- a field accessor for the specified field
-
getFieldAccessor
<FT> CTypeI.FieldAccessor<FT> getFieldAccessor(java.lang.reflect.Field field)
Gets a field accessor for the specified field.- Type Parameters:
FT- the field type- Parameters:
field- the field object- Returns:
- a field accessor for the specified field
-
addAnnotations
CTypeI<T> addAnnotations(java.lang.annotation.Annotation... aa)
Adds annotations to this type and returns a new type instance with the annotations.- Parameters:
aa- the annotations to add- Returns:
- a new type instance with the added annotations
-
getRawSimpleNameWithParameters
java.lang.String getRawSimpleNameWithParameters()
Gets the simple name of the raw type with type parameters.- Returns:
- the simple name with type parameters
-
getRawSimpleNameWithParameters
void getRawSimpleNameWithParameters(AString sb2)
Appends the simple name of the raw type with type parameters to the specified string builder.- Parameters:
sb2- the string builder to append to
-
getCanonicalNameWithParameters
java.lang.CharSequence getCanonicalNameWithParameters()
Gets the canonical name of the type with type parameters.- Returns:
- the canonical name with type parameters
-
getCanonicalNameWithParameters
void getCanonicalNameWithParameters(AString sb)
Appends the canonical name of the type with type parameters to the specified string builder.- Parameters:
sb- the string builder to append to
-
getRawSimpleName
java.lang.String getRawSimpleName()
Gets the simple name of the raw type.- Returns:
- the simple name of the raw type
-
declareCode
java.lang.String declareCode()
Gets the declaration code for this type, including annotations and type parameters.- Returns:
- the declaration code
-
toId
java.lang.String toId()
Gets a unique identifier for this type.- Returns:
- the unique identifier
-
getRaw
java.lang.Class<T> getRaw()
Gets the raw class representing this type.- Returns:
- the raw class
-
getRaw2
java.lang.Class<?> getRaw2()
Gets the raw class representing this type (alternative to getRaw).- Returns:
- the raw class
-
instanceOf
boolean instanceOf(java.lang.reflect.Type t)
Checks if this type is an instance of the specified type.- Parameters:
t- the type to check against- Returns:
- true if this type is an instance of the specified type, false otherwise
-
instanceOf
boolean instanceOf(CTypeI<?> t)
Checks if this type is an instance of the specified type.- Parameters:
t- the type to check against- Returns:
- true if this type is an instance of the specified type, false otherwise
-
instanceOf
boolean instanceOf(java.lang.reflect.AnnotatedType t)
Checks if this type is an instance of the specified annotated type.- Parameters:
t- the annotated type to check against- Returns:
- true if this type is an instance of the specified type, false otherwise
-
toType
@NotNull @NotNull java.lang.reflect.Type toType()
Converts this type to a standard Type object.- Returns:
- the Type representation
-
toAnnotatedType
@NotNull @NotNull java.lang.reflect.AnnotatedType toAnnotatedType()
Converts this type to an AnnotatedType object.- Returns:
- the AnnotatedType representation
-
getComponent
CTypeI<java.lang.Object> getComponent()
Gets the component type for array types.- Returns:
- the component type, or null if not an array
-
getComponentByName
CTypeI<java.lang.Object> getComponentByName(java.lang.String name)
Gets the component type by name for parameterized types.- Parameters:
name- the name of the type parameter- Returns:
- the component type, or null if not found
-
getComponent
CTypeI<java.lang.Object> getComponent(int i)
Gets the component type at the specified index.- Parameters:
i- the index of the component type- Returns:
- the component type, or null if not found
-
getComponent
CTypeI<java.lang.Object> getComponent(java.lang.Class<?> base, int i)
Gets the component type for the specified base class and index.- Parameters:
base- the base classi- the index of the type parameter- Returns:
- the resolved component type
-
isAnnotated
boolean isAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)
Checks if this type is annotated with the specified annotation.- Parameters:
aClass- the annotation class to check for- Returns:
- true if the annotation is present, false otherwise
-
getAnnotation
<A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> aClass)
Gets the specified annotation if present on this type.- Type Parameters:
A- the annotation type- Parameters:
aClass- the annotation class- Returns:
- the annotation, or null if not present
-
isArray
boolean isArray()
Checks if this type represents an array.- Returns:
- true if this is an array type, false otherwise
-
isPrimitive
boolean isPrimitive()
Checks if this type represents a primitive type.- Returns:
- true if this is a primitive type, false otherwise
-
isNumber
boolean isNumber()
Checks if this type represents a number (primitive or boxed).- Returns:
- true if this is a number type, false otherwise
-
isEnum
boolean isEnum()
Checks if this type represents an enum.- Returns:
- true if this is an enum type, false otherwise
-
isInterface
boolean isInterface()
Checks if this type represents an interface.- Returns:
- true if this is an interface, false otherwise
-
getGenericVariables
java.lang.reflect.TypeVariable<?>[] getGenericVariables()
Gets the type variables for generic types.- Returns:
- the type variables
-
getMethods
Flow<java.lang.reflect.Method> getMethods()
Gets all declared methods of this type.- Returns:
- a flow of declared methods
-
getAllFields
Flow<java.lang.reflect.Field> getAllFields()
Gets all fields of this type, including inherited ones.- Returns:
- a flow of all fields
-
getAllMethods
Flow<java.lang.reflect.Method> getAllMethods()
Gets all methods of this type, including inherited ones.- Returns:
- a flow of all methods
-
getFields
Flow<java.lang.reflect.Field> getFields()
Gets all declared fields of this type.- Returns:
- a flow of declared fields
-
getAnnotations
java.lang.annotation.Annotation[] getAnnotations()
Gets all annotations on this type.- Returns:
- an array of annotations
-
resolveReturnType
CTypeI<?> resolveReturnType(java.lang.reflect.Method m)
Resolves the return type of the specified method in the context of this type.- Parameters:
m- the method- Returns:
- the resolved return type
-
resolveTypeArgs
CTypeI<?>[] resolveTypeArgs(java.lang.reflect.Method m)
Resolves the type arguments of the specified method in the context of this type.- Parameters:
m- the method- Returns:
- an array of resolved type arguments
-
resolveExtend
CTypeI<?> resolveExtend(CTypeI<java.lang.Object> inf)
Resolves the extended type for the specified interface in the context of this type.- Parameters:
inf- the interface type- Returns:
- the resolved extended type
-
resolveTypeField
CTypeI<?> resolveTypeField(java.lang.reflect.Field f)
Resolves the type of the specified field in the context of this type.- Parameters:
f- the field- Returns:
- the resolved field type
-
isBoxedPrimitive
boolean isBoxedPrimitive()
Checks if this type represents a boxed primitive.- Returns:
- true if this is a boxed primitive, false otherwise
-
isBoxedOrRawPrimitive
boolean isBoxedOrRawPrimitive()
Checks if this type represents a boxed primitive or raw primitive.- Returns:
- true if this is a boxed or raw primitive, false otherwise
-
toPrimitive
CTypeI<T> toPrimitive()
Converts this type to its primitive equivalent if it's a boxed primitive.- Returns:
- the primitive type
-
getParameters
CTypeI<java.lang.Object>[] getParameters()
Gets the type parameters for this type.- Returns:
- an array of type parameters
-
getParent
CTypeI<? super T> getParent()
Gets the parent type of this type.- Returns:
- the parent type, or null if none exists
-
getChildrenClasses
CTypeI<? extends T>[] getChildrenClasses()
Gets the permitted subclasses for this sealed type.- Returns:
- an array of permitted subclasses
-
getAllDependencies
void getAllDependencies(java.util.Set<CTypeI<?>> res, boolean withTransient)
Collects all dependencies of this type.- Parameters:
res- the set to store dependencies inwithTransient- whether to include transient dependencies
-
getAllChildrenClasses
Flow<CTypeI<? extends T>> getAllChildrenClasses()
Gets all children classes of this type, including nested subclasses.- Returns:
- a flow of all children classes
-
isAbstract
boolean isAbstract()
Checks if this type is abstract.- Returns:
- true if this type is abstract, false otherwise
-
tryToBox
CTypeI<T> tryToBox()
Attempts to box this type if it's a primitive.- Returns:
- the boxed type, or this type if not primitive
-
getInterfaces
Flow<CTypeI<?>> getInterfaces()
Gets all interfaces implemented by this type.- Returns:
- a flow of interface types
-
makeAuto
T makeAuto(java.lang.Object... args)
Creates a new instance of this type with the specified arguments.- Parameters:
args- the constructor arguments- Returns:
- a new instance
-
getFieldVarHandle
java.lang.invoke.VarHandle getFieldVarHandle(java.lang.reflect.Field field)
Gets a VarHandle for the specified field.- Parameters:
field- the field- Returns:
- a VarHandle for the field
-
getFieldVarHandle
java.lang.invoke.VarHandle getFieldVarHandle(java.lang.String name)
Gets a VarHandle for the field with the specified name.- Parameters:
name- the field name- Returns:
- a VarHandle for the field
-
maker
ASupplier<?> maker()
Gets a supplier that can create instances of this type.- Returns:
- a supplier for creating instances
-
getConstructor
java.lang.reflect.Constructor<?> getConstructor(java.lang.Class<?>... args)
Gets the constructor with the specified parameter types.- Parameters:
args- the parameter types- Returns:
- the matching constructor, or null if not found
-
maker
java.lang.invoke.MethodHandle maker(java.lang.Class<?>... args)
Gets a MethodHandle for the constructor with the specified parameter types.- Parameters:
args- the parameter types- Returns:
- a MethodHandle for the constructor
-
getEnumValues
java.lang.Enum<?>[] getEnumValues()
Gets the enum values if this type represents an enum.- Returns:
- an array of enum values, or null if not an enum
-
isAetherClass
boolean isAetherClass()
Checks if this type is part of the Aether framework.- Returns:
- true if this is an Aether class, false otherwise
-
getCanonicalName
java.lang.String getCanonicalName()
Gets the canonical name of this type.- Returns:
- the canonical name
-
isParametrizedClass
boolean isParametrizedClass()
Checks if this type is a parameterized class.- Returns:
- true if this is a parameterized class, false otherwise
-
isVariable
boolean isVariable()
Checks if this type is a type variable.- Returns:
- true if this is a type variable, false otherwise
-
isParameterizedType
boolean isParameterizedType()
Checks if this type is a parameterized type.- Returns:
- true if this is a parameterized type, false otherwise
-
getPackage
java.lang.String getPackage()
Gets the package name for this type.- Returns:
- the package name
-
isInstance
boolean isInstance(java.lang.Object o)
Checks if the specified object is an instance of this type.- Parameters:
o- the object to check- Returns:
- true if the object is an instance of this type, false otherwise
-
compareValues
boolean compareValues(T val1, T val2, CTypeI.CompareEvent consumer)
Compares two values of this type, potentially using custom comparison logic.- Parameters:
val1- the first valueval2- the second valueconsumer- the comparison event consumer- Returns:
- true if the values are equal, false otherwise
-
cast
<C> CTypeI<C> cast()
Casts this type to the specified type.- Type Parameters:
C- the target type- Returns:
- the cast type
-
getClassLoader
java.lang.ClassLoader getClassLoader()
Gets the class loader associated with this type.- Returns:
- the class loader
-
cast
T cast(java.lang.Object o)
Casts the specified object to this type.- Parameters:
o- the object to cast- Returns:
- the cast object
-
of
static <T> CTypeI<T> of(java.lang.Class<T> type)
Creates a type instance for the specified class.- Type Parameters:
T- the type- Parameters:
type- the class- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.reflect.Type type)
Creates a type instance for the specified type.- Type Parameters:
T- the type- Parameters:
type- the type- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.reflect.AnnotatedType type)
Creates a type instance for the specified annotated type.- Type Parameters:
T- the type- Parameters:
type- the annotated type- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.annotation.Annotation aa, java.lang.Class<T> type, java.lang.reflect.AnnotatedType... args)
Creates a type instance with the specified annotation, class, and type arguments.- Type Parameters:
T- the type- Parameters:
aa- the annotationtype- the classargs- the type arguments- Returns:
- the type instance
-
of
static CTypeI<java.lang.Object> of(java.lang.annotation.Annotation[] aa, java.lang.Class<?> type, java.lang.reflect.AnnotatedType... args)
Creates a type instance with the specified annotations, class, and type arguments.- Parameters:
aa- the annotationstype- the classargs- the type arguments- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.annotation.Annotation[] aa, java.lang.Class<T> type, java.lang.reflect.Type... args)
Creates a type instance with the specified annotations, class, and type arguments.- Type Parameters:
T- the type- Parameters:
aa- the annotationstype- the classargs- the type arguments- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.annotation.Annotation[] aa, java.lang.reflect.Type type)
Creates a type instance with the specified annotations and type.- Type Parameters:
T- the type- Parameters:
aa- the annotationstype- the type- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.annotation.Annotation[] aa, CTypeI<T> type)
Creates a type instance with the specified annotations and existing type.- Type Parameters:
T- the type- Parameters:
aa- the annotations to addtype- the existing type- Returns:
- the new type instance with added annotations
-
of
static <T> CTypeI<T> of(java.lang.Class<? super T> raw, java.lang.reflect.Type... args)
Creates a type instance for the specified raw class and type arguments.- Type Parameters:
T- the type- Parameters:
raw- the raw classargs- the type arguments- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.Class<? super T> raw, CTypeI<?>... args)
Creates a type instance for the specified raw class and type arguments.- Type Parameters:
T- the type- Parameters:
raw- the raw classargs- the type arguments- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.reflect.AnnotatedType raw, java.lang.reflect.AnnotatedType[] args)
Creates a type instance for the specified raw annotated type and type arguments.- Type Parameters:
T- the type- Parameters:
raw- the raw annotated typeargs- the type arguments- Returns:
- the type instance
-
of
static <T> CTypeI<T> of(java.lang.reflect.AnnotatedType raw, CTypeI<java.lang.Object>[] args)
Creates a type instance for the specified raw annotated type and type arguments.- Type Parameters:
T- the type- Parameters:
raw- the raw annotated typeargs- the type arguments- Returns:
- the type instance
-
buildArray
static <T> CTypeI<T[]> buildArray(java.lang.reflect.Type component)
Creates an array type for the specified component type.- Type Parameters:
T- the component type- Parameters:
component- the component type- Returns:
- the array type
-
buildArray
static <T> CTypeI<T[]> buildArray(java.lang.reflect.AnnotatedType component, java.lang.annotation.Annotation[] annotations)
Creates an array type for the specified component type with annotations.- Type Parameters:
T- the component type- Parameters:
component- the component typeannotations- the annotations- Returns:
- the array type
-
buildArray
static <T> CTypeI<T[]> buildArray(CTypeI<T> component)
Creates an array type for the specified component type.- Type Parameters:
T- the component type- Parameters:
component- the component type- Returns:
- the array type
-
buildArray
static CTypeI<java.lang.Object> buildArray(CTypeI<java.lang.Object> component, java.lang.annotation.Annotation[] annotations)
Creates an array type for the specified component type with annotations.- Parameters:
component- the component typeannotations- the annotations- Returns:
- the array type
-
of
static <T> CTypeI<T> of(java.lang.reflect.Type res, java.util.List<java.lang.reflect.Type> pp)
Creates a type instance for the specified type and parameters.- Type Parameters:
T- the type- Parameters:
res- the typepp- the parameters- Returns:
- the type instance
-
annotationToCode
static java.lang.String annotationToCode(java.lang.annotation.Annotation a)
Converts an annotation to its code representation.- Parameters:
a- the annotation- Returns:
- the code representation
-
annotationToBuildCode
static java.lang.String annotationToBuildCode(java.lang.annotation.Annotation a)
Converts an annotation to its build code representation.- Parameters:
a- the annotation- Returns:
- the build code representation
-
annotationToBuildCode
static void annotationToBuildCode(java.lang.StringBuilder sb, java.lang.annotation.Annotation a)Appends the build code representation of an annotation to the specified string builder.- Parameters:
sb- the string buildera- the annotation
-
annotationToCode
static void annotationToCode(java.lang.StringBuilder sb, java.lang.annotation.Annotation a)Appends the code representation of an annotation to the specified string builder.- Parameters:
sb- the string buildera- the annotation
-
annotation
static <T extends java.lang.annotation.Annotation> T annotation(java.lang.Class<T> type, java.util.Map<java.lang.String,java.lang.Object> args)Creates an annotation instance of the specified type with the given values.- Type Parameters:
T- the annotation type- Parameters:
type- the annotation classargs- the annotation values- Returns:
- the annotation instance
-
getDefaultConstructor
static java.lang.reflect.Constructor<?> getDefaultConstructor(java.lang.Class<?> c)
Gets the default (no-arg) constructor for the specified class.- Parameters:
c- the class- Returns:
- the default constructor, or null if not found
-
getAllFields
static void getAllFields(java.lang.Class<?> raw, java.util.List<java.lang.reflect.Field> res)Collects all fields (including inherited) for the specified class.- Parameters:
raw- the classres- the list to store fields in
-
getAllMethods
static void getAllMethods(java.lang.Class<?> raw, java.util.Set<java.lang.reflect.Method> res)Collects all methods (including inherited) for the specified class.- Parameters:
raw- the classres- the set to store methods in
-
getAllParentClasses
static Flow<java.lang.Class<?>> getAllParentClasses(java.lang.Class<?> type)
Gets a flow of all parent classes and interfaces for the specified type.- Parameters:
type- the starting type- Returns:
- a flow of parent types
-
getAllAnnotations
static Flow<java.lang.annotation.Annotation> getAllAnnotations(java.lang.Class<?> type)
Gets a flow of all annotations on the specified type and its parents.- Parameters:
type- the type- Returns:
- a flow of annotations
-
-