Class ReflectiveProxy<T extends ReflectiveProxyObject>
java.lang.Object
com.cryptomorin.xseries.reflection.proxy.ReflectiveProxy<T>
- All Implemented Interfaces:
InvocationHandler
@Internal
public final class ReflectiveProxy<T extends ReflectiveProxyObject>
extends Object
implements InvocationHandler
The basis of this class is that you create an
interface class and annotate it using
Class, Field, Constructor, etc... annotations to mark how
these methods are resolved for different versions. Everything is accessed through methods,
even constructors and fields are accessed in forms of methods.
Due to the fact that this method uses annotations and Java's Proxy mechanism, the startup
and the invocation of the methods is pretty slow compared to the normal XReflection APIs.
It doesn't seem like we can use LambdaMetafactory for generating this
type of interface since they're not functional interfaces.
- Since:
- 13.0.0
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionReturns a newReflectiveProxyObjectthat's linked to a newReflectiveProxywith the given instance.static voidcheckInterfaceClass(Class<?> interfaceClass) @Nullable Objectinstance()static <T extends ReflectiveProxyObject>
ReflectiveProxy<T> proxy()toString()
-
Method Details
-
proxify
-
checkInterfaceClass
-
createProxy
-
proxy
-
instance
-
bindTo
Returns a newReflectiveProxyObjectthat's linked to a newReflectiveProxywith the given instance.- Parameters:
instance- the instance to bind.
-
invoke
public Object invoke(Object proxy, Method method, @Nullable @Nullable Object[] args) throws Throwable - Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
toString
-