com.vaadin.flow.templatemodel.
Class TemplateModelProxyHandler
- java.lang.Object
-
- com.vaadin.flow.templatemodel.TemplateModelProxyHandler
-
All Implemented Interfaces:
public class TemplateModelProxyHandler extends Object implements Serializable
Invocation handler for
TemplateModel
proxy objects.Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
TemplateModelProxyHandler.InterfaceProxy
Base type used for interface proxy types.
protected static interface
TemplateModelProxyHandler.ModelProxy
Gives access to the state node of a proxy instance.
-
Method Summary
All Methods Modifier and Type Method and Description static <T> T
createModelProxy(StateNode stateNode, BeanModelType<T> modelType)
Creates a proxy object for the given
modelType
type for the given state node.static BeanModelType<?>
getModelTypeForProxy(Object proxy)
Gets the model type that a proxy instance is bound to.
static StateNode
getStateNodeForProxy(Object proxy)
Gets the state node that a proxy is bound to.
Object
intercept(Object target, Method method, Object[] args)
Processes a method invocation on a Byte buddy proxy instance and returns the result.
static boolean
isProxy(Object proxy)
Checks if the given object is a proxy created by this class.
-
-
-
Method Detail
-
intercept
@RuntimeType public Object intercept(@This Object target, @Origin Method method, @AllArguments Object[] args)
Processes a method invocation on a Byte buddy proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.
Parameters:
target
- the proxy instancemethod
- theMethod
instance corresponding to the proxied method invoked on the proxy instance.args
- an array of objects containing the values of the arguments passed in the method invocation on the proxy instance.Returns:
the value to return from the method invocation on the proxy instance.
-
createModelProxy
public static <T> T createModelProxy(StateNode stateNode, BeanModelType<T> modelType)
Creates a proxy object for the given
modelType
type for the given state node.Type Parameters:
T
- the proxy typeParameters:
stateNode
- the state node, notnull
modelType
- the type of the model, notnull
Returns:
a proxy object, not
null
-
getStateNodeForProxy
public static StateNode getStateNodeForProxy(Object proxy)
Gets the state node that a proxy is bound to.
Parameters:
proxy
- the template model proxyReturns:
the state node of the proxy
-
getModelTypeForProxy
public static BeanModelType<?> getModelTypeForProxy(Object proxy)
Gets the model type that a proxy instance is bound to.
Parameters:
proxy
- the template model proxyReturns:
the model type of the proxy
-
isProxy
public static boolean isProxy(Object proxy)
Checks if the given object is a proxy created by this class.
Parameters:
proxy
- the object to checkReturns:
true
if the given object is a proxy object,false
otherwise
-
-