org.perfectjpattern.core.structural.proxy
Class SynchronizedProxy<C>

java.lang.Object
  extended by org.perfectjpattern.core.structural.AbstractSurrogate<C,C>
      extended by org.perfectjpattern.core.structural.proxy.AbstractProxy<C>
          extended by org.perfectjpattern.core.structural.proxy.SynchronizedProxy<C>
Type Parameters:
C - Decorated Component type
All Implemented Interfaces:
InvocationHandler, ISurrogate<C>, IProxy<C>

public class SynchronizedProxy<C>
extends AbstractProxy<C>

Concrete componentized implementation of IDecorator<C> that provides synchronized protection to any class type.

Version:
$Revision: 1.0 $ $Date: Nov 25, 2007 4:11:47 PM $
Author:
Giovanni Azua
 

Constructor Summary
SynchronizedProxy(Class<C> anInterface, C aComponent)
          Creates a SynchronizedDecorator<E> from a Component interface type and instance.
 
Method Summary
protected  Object invokeUnderlying(Method anMethod, Object[] anArguments)
          Returns the result of the Method invocation.
 
Methods inherited from class org.perfectjpattern.core.structural.proxy.AbstractProxy
getRealSubject, getSubject
 
Methods inherited from class org.perfectjpattern.core.structural.AbstractSurrogate
equals, getComponent, getComponentClass, getUnderlying, hashCode, invoke
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.perfectjpattern.core.api.structural.ISurrogate
getComponent
 
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
 

Constructor Detail

SynchronizedProxy

public SynchronizedProxy(Class<C> anInterface,
                         C aComponent)
                  throws IllegalArgumentException
Creates a SynchronizedDecorator<E> from a Component interface type and instance.

Parameters:
anInterface - The Component interface type.
aComponent - The Component instance to Decorate.
Throws:
IllegalArgumentException - 'anInterface' must not be null.
IllegalArgumentException - 'anInterface' must be an interface type.
IllegalArgumentException - 'aComponent' must not be null.
Method Detail

invokeUnderlying

protected Object invokeUnderlying(Method anMethod,
                                  Object[] anArguments)
                           throws Throwable
Returns the result of the Method invocation. This method has two main purposes:

Overrides:
invokeUnderlying in class AbstractSurrogate<C,C>
Parameters:
anMethod - Method to invoke
anArguments - Array of input arguments for the Method to invoke
Returns:
result of the Method invocation
Throws:
Throwable


Copyright © 2007-2009. All Rights Reserved.