Package spin
Class ProxyFactory
java.lang.Object
spin.ProxyFactory
- Direct Known Subclasses:
CGLibProxyFactory
,JDKProxyFactory
A factory of proxies which intercept invocations, using Evaluators to
evaluate them.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
areProxyEqual
(Object proxy1, Object proxy2) Test if the given proxies of this factory are intercepting the same object.abstract Object
createProxy
(Object object, Evaluator evaluator) Create a proxy for the given object that evaluates invocations with the given evaluator.protected Object
evaluteInvocation
(Evaluator evaluator, Object proxy, Invocation invocation) Evaluate the given invocation with the given evaluator.abstract boolean
Test if the given object is a proxy created by this factory.
-
Constructor Details
-
ProxyFactory
public ProxyFactory()
-
-
Method Details
-
createProxy
Create a proxy for the given object that evaluates invocations with the given evaluator.- Parameters:
object
- object to create proxy forevaluator
- evaluator to evaluate invocations with- Returns:
- new proxy
-
isProxy
Test if the given object is a proxy created by this factory.- Parameters:
object
- object to test- Returns:
true
if given object is a Spin proxy,false
otherwise
-
areProxyEqual
Test if the given proxies of this factory are intercepting the same object.- Parameters:
proxy1
- first proxyproxy2
- second proxy- Returns:
- true if both proxies are intercepting the same object
-
evaluteInvocation
protected Object evaluteInvocation(Evaluator evaluator, Object proxy, Invocation invocation) throws Throwable Evaluate the given invocation with the given evaluator.- Parameters:
evaluator
- evaluator to evaluate withproxy
- proxy that intcepted the invocationinvocation
- the invocation to evaluate- Returns:
- result of evaluation
- Throws:
Throwable
-