|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.perfectjpattern.core.structural.AbstractSurrogate<C,U>
C
- Component
or wrapper element typeU
- Underlying
wrapped element typepublic abstract class AbstractSurrogate<C,U>
Concrete implementation of ISurrogate
that groups common
functionality for single instance surrogates.
Constructor Summary | |
---|---|
AbstractSurrogate(Class<C> aSurrogateClass,
U anUnderlying)
Creates an AbstractSurrogate<C> given a Component
interface type and an instance of the underlying wrapped object. |
Method Summary | |
---|---|
boolean |
equals(Object anObject)
|
C |
getComponent()
Returns the Component interface view <C>
of this ISurrogate Client code calls this method to receive an instance of type <C> making accessible the Component business methods
while the underlying implementation is wrapped by this surrogate. |
protected Class<C> |
getComponentClass()
Returns the Component class |
protected U |
getUnderlying()
|
int |
hashCode()
|
Object |
invoke(Object aProxy,
Method aMethod,
Object[] anArguments)
|
protected Object |
invokeUnderlying(Method aMethod,
Object[] anArguments)
Returns the result of the Method invocation. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractSurrogate(Class<C> aSurrogateClass, U anUnderlying) throws IllegalArgumentException
Component
interface type and an instance of the underlying wrapped object.
aSurrogateClass
- The desired Surrogate
interface typeanUnderlying
- Underlying
instance to surrogate
IllegalArgumentException
- 'anInterface' must not be null
IllegalArgumentException
- 'anInterface' must be an interface type
IllegalArgumentException
- 'aComponent' must not be nullMethod Detail |
---|
public final C getComponent()
Component
interface view <C>
of this ISurrogate
<C>
making accessible the Component business methods
while the underlying implementation is wrapped by this surrogate.
getComponent
in interface ISurrogate<C>
Component
interface view <C>
of this ISurrogate
typepublic final Object invoke(Object aProxy, Method aMethod, Object[] anArguments) throws Throwable
invoke
in interface InvocationHandler
Throwable
public final boolean equals(Object anObject)
equals
in class Object
public final int hashCode()
hashCode
in class Object
protected final U getUnderlying()
protected Object invokeUnderlying(Method aMethod, Object[] anArguments) throws Throwable
aMethod
- Method to invokeanArguments
- Array of input arguments for the Method to invoke
Throwable
protected final Class<C> getComponentClass()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |