Interface ReflectionService
- All Known Implementing Classes:
DefaultReflectionService
This service provides two APIs, the Instantiator and the MethodMirror. The purpose of separating
these interfaces is to make it easy for different reflection service implementations to re-share one or the other
object.
API status
Because of this API's status as a service provider, it may require updating to keep in sync with the library's
minor versions. Some minor versions might offer new features, which would need to be implemented by this interface
and its Instantiator/MethodMirror implementations.
If implementations of ReflectionService are not updated, they will still be compatible with the library in a
strict sense. Existing code will never break. However, newer features may be disabled or refuse to work.
Lookup
Both the methods on this interface take a lookup parameter. By default, ths library will pass a lookup
representing its own space.arim.dazzleconf module. If the library user specifies another lookup, it will be
passed instead.
Implementors can rely on this lookup having full privileged access, however. Thus, the implementor may rely on it for reflective access to an interface that is to be implemented, invokespecial on one of its methods, or for loading or defining classes implementing that interface.
-
Method Summary
Modifier and TypeMethodDescription@NonNull InstantiatormakeInstantiator(@NonNull MethodHandles.Lookup lookup) Gets the instantiator this service provides.@NonNull MethodMirrormakeMethodMirror(@NonNull MethodHandles.Lookup lookup) Gets theMethodMirrorthis service provides.
-
Method Details
-
makeInstantiator
Gets the instantiator this service provides.The instantiator is responsible for generating and instantiating implementations of the configuration interface.
- Parameters:
lookup- the lookup to use for privileged access- Returns:
- an instantiator
-
makeMethodMirror
Gets theMethodMirrorthis service provides.The method mirror is responsible for
The method mirror is supplied by this function, and it may share resources and techniques with the instantiator. In particular,
MethodMirror.makeInvoker(Object, Class)can be more efficient when used with objects generated by the same instantiator inmakeInstantiator(MethodHandles.Lookup).- Parameters:
lookup- the lookup to use for privileged access- Returns:
- a method mirror
-