org.apache.commons.proxy.factory.util
Class AbstractSubclassingProxyFactory

java.lang.Object
  extended by org.apache.commons.proxy.ProxyFactory
      extended by org.apache.commons.proxy.factory.util.AbstractSubclassingProxyFactory
Direct Known Subclasses:
CglibProxyFactory, JavassistProxyFactory

public abstract class AbstractSubclassingProxyFactory
extends ProxyFactory

A useful superclass for a ProxyFactory which supports subclassing rather than merely implementing interfaces.

Since:
1.0
Author:
James Carman

Constructor Summary
AbstractSubclassingProxyFactory()
           
 
Method Summary
 boolean canProxy(Class[] proxyClasses)
          Returns true if a suitable superclass can be found, given the desired proxyClasses.
static Class getSuperclass(Class[] proxyClasses)
          Returns either Object if all of the proxyClasses are interfaces or the single non-interface class from proxyClasses.
protected static Class[] toInterfaces(Class[] proxyClasses)
          Returns the proxyClasses transformed into an array of only the interface classes.
 
Methods inherited from class org.apache.commons.proxy.ProxyFactory
createDelegatorProxy, createDelegatorProxy, createInterceptorProxy, createInterceptorProxy, createInvokerProxy, createInvokerProxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSubclassingProxyFactory

public AbstractSubclassingProxyFactory()
Method Detail

toInterfaces

protected static Class[] toInterfaces(Class[] proxyClasses)
Returns the proxyClasses transformed into an array of only the interface classes.

Parameters:
proxyClasses - the proxy classes
Returns:
the proxyClasses transformed into an array of only the interface classes

canProxy

public boolean canProxy(Class[] proxyClasses)
Returns true if a suitable superclass can be found, given the desired proxyClasses.

Overrides:
canProxy in class ProxyFactory
Parameters:
proxyClasses - the proxy classes
Returns:
true if a suitable superclass can be found, given the desired proxyClasses

getSuperclass

public static Class getSuperclass(Class[] proxyClasses)
Returns either Object if all of the proxyClasses are interfaces or the single non-interface class from proxyClasses.

Parameters:
proxyClasses - the proxy classes
Returns:
either Object if all of the proxyClasses are interfaces or the single non-interface class from proxyClasses
Throws:
ProxyFactoryException - if multiple non-interface classes are contained in proxyClasses or any of the non-interface classes are final


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.