ReflectedClass

value class ReflectedClass<T : Any>(val javaClass: Class<T>)

Inlined wrapper for a Class providing reflection API using libGDX reflection utilities.

To ensure cross-platform compatibility, libGDX reflection API should be used over direct Class and KClass usage.

Constructors

Link copied to clipboard
constructor(kotlinClass: KClass<T>)

Extracts javaClass from the given kotlinClass.

constructor(javaClass: Class<T>)

Properties

Link copied to clipboard
val annotations: Array<Annotation>
Link copied to clipboard
Link copied to clipboard
val constructor: Constructor

Accesses constructor of the class using libGDX reflection API.

Link copied to clipboard
val constructors: Array<Constructor>
Link copied to clipboard
val declaredAnnotations: Array<Annotation>
Link copied to clipboard
val declaredFields: Array<Field>
Link copied to clipboard
val declaredMethods: Array<Method>
Link copied to clipboard
Link copied to clipboard
val fields: Array<Field>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val methods: Array<Method>
Link copied to clipboard

Functions

Link copied to clipboard
inline fun <T : Annotation> getAnnotation(): Annotation?
fun <T : Annotation> getAnnotation(annotationClass: Class<T>): Annotation?
fun <T : Annotation> getAnnotation(annotationClass: KClass<T>): Annotation?

Finds an Annotation of the selected T type.

Link copied to clipboard
fun getConstructor(vararg parameterTypes: Class<*>): Constructor
fun getConstructor(vararg parameterTypes: KClass<*>): Constructor

Finds a constructor given the selected parameterTypes.

Link copied to clipboard
inline fun <T : Annotation> getDeclaredAnnotation(): Annotation?
fun <T : Annotation> getDeclaredAnnotation(annotationClass: Class<T>): Annotation?
fun <T : Annotation> getDeclaredAnnotation(annotationClass: KClass<T>): Annotation?

Finds an Annotation of the selected T type.

Link copied to clipboard
fun getDeclaredConstructor(vararg parameterTypes: Class<*>): Constructor
fun getDeclaredConstructor(vararg parameterTypes: KClass<*>): Constructor

Finds a declared constructor given the selected parameterTypes.

Link copied to clipboard
fun getDeclaredField(name: String): Field

Finds a declared field with the given name.

Link copied to clipboard
fun getDeclaredMethod(name: String, vararg parameterTypes: Class<*>): Method
fun getDeclaredMethod(name: String, vararg parameterTypes: KClass<*>): Method

Finds a declared method with the given name consuming given parameterTypes.

Link copied to clipboard
fun getField(name: String): Field

Finds a field with the given name.

Link copied to clipboard
fun getMethod(name: String, vararg parameterTypes: Class<*>): Method
fun getMethod(name: String, vararg parameterTypes: KClass<*>): Method

Finds a method with the given name consuming given parameterTypes.

Link copied to clipboard
fun <T : Annotation> isAnnotationPresent(annotationType: Class<T>): Boolean
fun <T : Annotation> isAnnotationPresent(annotationType: KClass<T>): Boolean

Checks if javaClass is annotated with T annotation.

Link copied to clipboard
inline fun <T> isAssignableFrom(): Boolean
fun isAssignableFrom(fromClass: Class<*>): Boolean
fun isAssignableFrom(fromClass: KClass<*>): Boolean
Link copied to clipboard
fun isInstance(value: Any?): Boolean
Link copied to clipboard

Creates a new array instance with the given size with the javaClass as component type.

Link copied to clipboard
fun newInstance(): T

Attempts to create a new instance of the javaClass with the no-arg constructor.