Top Description Fields Constructors Methods
nonapi.io.github.classgraph.reflection

pack-priv Class NarcissusReflectionDriver

extends ReflectionDriver
Class Inheritance
Imports
java.lang.reflect.AccessibleObject, .Constructor, .Field, .Method

Narcissus reflection driver (uses the Narcissus library, if it is available, which allows access to non-public fields and methods, circumventing encapsulation and visibility controls via JNI).

Field Summary

Modifier and TypeField and Description
private final Method
private final Method
private final Method
private final Method
private final Method
private final Method
private final Method
private final Method
private final Class<?>
private final Method
private final Method

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Class<?>
findClass(final String
the class name
className
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.findClass.

Find a class by name.

pack-priv <T> Constructor<T>[]
getDeclaredConstructors(final Class<T>
the class
cls
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredConstructors.

Get declared constructors for class.

pack-priv Field[]
getDeclaredFields(final Class<?>
the class
cls
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredFields.

Get declared fields for class.

pack-priv Method[]
getDeclaredMethods(final Class<?>
the class
cls
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredMethods.

Get declared methods for class.

pack-priv Object
getField(final Object
the object instance to get the field value from
object
,
final Field
the non-static field
field
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getField.

Get the value of a non-static field, boxing the value if necessary.

pack-priv Object
getStaticField(final Field
the static field
field
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getStaticField.

Get the value of a static field, boxing the value if necessary.

pack-priv Object
invokeMethod(final Object
the object instance to invoke the method on
object
,
final Method
the non-static method
method
,
final Object...
the method arguments (or new Object[0] if there are no args)
args
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.invokeMethod.

Invoke a non-static method, boxing the result if necessary.

pack-priv Object
invokeStaticMethod(final Method
the static method
method
,
final Object...
the method arguments (or new Object[0] if there are no args)
args
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.invokeStaticMethod.

Invoke a static method, boxing the result if necessary.

public boolean
isAccessible(final Object
the object instance, or null if static.
instance
,
final AccessibleObject
the field or method.
obj
)

Overrides nonapi.io.github.classgraph.reflection.ReflectionDriver.isAccessible.

Check whether a field or method is accessible.

public boolean
makeAccessible(final Object
the object instance, or null if static.
instance
,
final AccessibleObject
the field or method.
accessibleObject
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.makeAccessible.

Make a field or method accessible.

pack-priv void
setField(final Object
the object instance to get the field value from
object
,
final Field
the non-static field
field
,
final Object
the value to set
value
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.setField.

Set the value of a non-static field, unboxing the value if necessary.

pack-priv void
setStaticField(final Field
the static field
field
,
final Object
the value to set
value
)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.setStaticField.

Set the value of a static field, unboxing the value if necessary.

Inherited from nonapi.io.github.classgraph.reflection.ReflectionDriver:
findFieldfindInstanceFieldfindInstanceMethodfindMethodfindStaticFieldfindStaticMethod

Field Detail

findClassback to summary
private final Method findClass
getDeclaredConstructorsback to summary
private final Method getDeclaredConstructors
getDeclaredFieldsback to summary
private final Method getDeclaredFields
getDeclaredMethodsback to summary
private final Method getDeclaredMethods
getFieldback to summary
private final Method getField
getStaticFieldback to summary
private final Method getStaticField
invokeMethodback to summary
private final Method invokeMethod
invokeStaticMethodback to summary
private final Method invokeStaticMethod
narcissusClassback to summary
private final Class<?> narcissusClass
setFieldback to summary
private final Method setField
setStaticFieldback to summary
private final Method setStaticField

Constructor Detail

NarcissusReflectionDriverback to summary
pack-priv NarcissusReflectionDriver() throws Exception

Method Detail

findClassback to summary
pack-priv Class<?> findClass(final String className) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.findClass.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.findClass.

Find a class by name.

Parameters
className:String

the class name

Returns:Class<?>

the class reference

Annotations
@Override
getDeclaredConstructorsback to summary
pack-priv <T> Constructor<T>[] getDeclaredConstructors(final Class<T> cls) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredConstructors.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredConstructors.

Get declared constructors for class.

Parameters
<T>
the generic type
cls:Class<T>

the class

Returns:Constructor<T>[]

the declared constructors

Annotations
@SuppressWarnings:unchecked
@Override
getDeclaredFieldsback to summary
pack-priv Field[] getDeclaredFields(final Class<?> cls) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredFields.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredFields.

Get declared fields for class.

Parameters
cls:Class<?>

the class

Returns:Field[]

the declared fields

Annotations
@Override
getDeclaredMethodsback to summary
pack-priv Method[] getDeclaredMethods(final Class<?> cls) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredMethods.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.getDeclaredMethods.

Get declared methods for class.

Parameters
cls:Class<?>

the class

Returns:Method[]

the declared methods

Annotations
@Override
getFieldback to summary
pack-priv Object getField(final Object object, final Field field) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getField.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.getField.

Get the value of a non-static field, boxing the value if necessary.

Parameters
object:Object

the object instance to get the field value from

field:Field

the non-static field

Returns:Object

the value of the field

Annotations
@Override
getStaticFieldback to summary
pack-priv Object getStaticField(final Field field) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.getStaticField.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.getStaticField.

Get the value of a static field, boxing the value if necessary.

Parameters
field:Field

the static field

Returns:Object

the static field

Annotations
@Override
invokeMethodback to summary
pack-priv Object invokeMethod(final Object object, final Method method, final Object... args) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.invokeMethod.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.invokeMethod.

Invoke a non-static method, boxing the result if necessary.

Parameters
object:Object

the object instance to invoke the method on

method:Method

the non-static method

args:Object[]

the method arguments (or new Object[0] if there are no args)

Returns:Object

the return value (possibly a boxed value)

Annotations
@Override
invokeStaticMethodback to summary
pack-priv Object invokeStaticMethod(final Method method, final Object... args) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.invokeStaticMethod.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.invokeStaticMethod.

Invoke a static method, boxing the result if necessary.

Parameters
method:Method

the static method

args:Object[]

the method arguments (or new Object[0] if there are no args)

Returns:Object

the return value (possibly a boxed value)

Annotations
@Override
isAccessibleback to summary
public boolean isAccessible(final Object instance, final AccessibleObject obj)

Overrides nonapi.io.github.classgraph.reflection.ReflectionDriver.isAccessible.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.isAccessible.

Check whether a field or method is accessible.

N.B. this is overridden in Narcissus driver to just return true, since everything is accessible to JNI.

Parameters
instance:Object

the object instance, or null if static.

obj:AccessibleObject

the field or method.

Returns:boolean

true if accessible.

Annotations
@Override
makeAccessibleback to summary
public boolean makeAccessible(final Object instance, final AccessibleObject accessibleObject)

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.makeAccessible.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.makeAccessible.

Make a field or method accessible.

Parameters
instance:Object

the object instance, or null if static.

accessibleObject:AccessibleObject

the field or method.

Returns:boolean

true if successful.

Annotations
@Override
setFieldback to summary
pack-priv void setField(final Object object, final Field field, final Object value) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.setField.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.setField.

Set the value of a non-static field, unboxing the value if necessary.

Parameters
object:Object

the object instance to get the field value from

field:Field

the non-static field

value:Object

the value to set

Annotations
@Override
setStaticFieldback to summary
pack-priv void setStaticField(final Field field, final Object value) throws Exception

Implements abstract nonapi.io.github.classgraph.reflection.ReflectionDriver.setStaticField.

Doc from nonapi.io.github.classgraph.reflection.ReflectionDriver.setStaticField.

Set the value of a static field, unboxing the value if necessary.

Parameters
field:Field

the static field

value:Object

the value to set

Annotations
@Override