public class

DuckTypeProxyFactory

extends Object
java.lang.Object
   ↳ com.atlassian.jira.util.DuckTypeProxyFactory

Class Overview

Use this Factory to produce "Duck Type" proxies of a given interface with a delegate object that "implements" a subset of the interface methods.

Summary

Public Constructors
DuckTypeProxyFactory()
Public Methods
static <T> T newLooseProxyInstance(Class<T> proxyInterface, Object delegate)
Creates a new Proxy instance for the given interface.
static <T> T newStrictProxyInstance(Class<T> proxyInterface, Object delegate)
Creates a new Proxy instance for the given interface.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DuckTypeProxyFactory ()

Public Methods

public static T newLooseProxyInstance (Class<T> proxyInterface, Object delegate)

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.

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.

public static T newStrictProxyInstance (Class<T> proxyInterface, Object delegate)

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.

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.