Package com.atlassian.jira.util
Class DuckTypeProxyFactory
java.lang.Object
com.atlassian.jira.util.DuckTypeProxyFactory
Use this Factory to produce "Duck Type" proxies of a given interface with a delegate object that "implements" a
subset of the interface methods.
invalid input: '<'p
- Since:
- v6.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TnewLooseProxyInstance(Class<T> proxyInterface, Object delegate) Creates a new Proxy instance for the given interface.static <T> TnewStrictProxyInstance(Class<T> proxyInterface, Object delegate) Creates a new Proxy instance for the given interface.
-
Constructor Details
-
DuckTypeProxyFactory
public DuckTypeProxyFactory()
-
-
Method Details
-
newStrictProxyInstance
Creates a new Proxy instance for the given interface.If any methods are called on the interface that are not defined in the delegate, then it will throw UnsupportedOperationException.
- Type Parameters:
T- Type of the interface- Parameters:
proxyInterface- the interface to create a proxy for.delegate- the object to delegate to for implementations (quacks like a duck)- Returns:
- a new Proxy instance for the given interface.
-
newLooseProxyInstance
Creates a new Proxy instance for the given interface.If any methods are called on the interface that are not defined in the delegate, then it will return null.
- Type Parameters:
T- Type of the interface- Parameters:
proxyInterface- the interface to create a proxy for.delegate- the object to delegate to for implementations (quacks like a duck)- Returns:
- a new Proxy instance for the given interface.
-