|
Invocation API 1.1.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.invocation.proxy.AbstractClassFactory<T>
org.jboss.invocation.proxy.AbstractSubclassFactory<T>
T - the superclass typepublic abstract class AbstractSubclassFactory<T>
Class factory for classes that override superclass methods.
This class extendsAbstractClassFactory by adding convenience methods to override methods on the superclass.
| Field Summary | |
|---|---|
protected ReflectionMetadataSource |
reflectionMetadataSource
The metadata source used to generate the proxy |
| Fields inherited from class org.jboss.invocation.proxy.AbstractClassFactory |
|---|
classFile |
| Constructor Summary | |
|---|---|
protected |
AbstractSubclassFactory(String className,
Class<T> superClass,
ClassLoader classLoader,
ProtectionDomain protectionDomain,
ReflectionMetadataSource reflectionMetadataSource)
Construct a new instance. |
| Method Summary | |
|---|---|
protected boolean |
addInterface(Class<?> interfaceClass)
Adds an interface to the generated subclass, using the default MethodBodyCreator to generate the method bodies. |
protected boolean |
addInterface(MethodBodyCreator override,
Class<?> interfaceClass)
Adds an interface to the generated subclass, using the given MethodBodyCreator to generate the method bodies |
protected void |
cleanup()
Cleans up any resources left over from generating the class. |
protected void |
createConstructorDelegates()
Adds a constructor for every non-private constructor present on the superclass. |
protected void |
createConstructorDelegates(ConstructorBodyCreator creator)
Adds constructors that delegate the the superclass constructor for all non-private constructors present on the superclass |
ConstructorBodyCreator |
getDefaultConstructorOverride()
Returns the default ConstructorBodyCreator to use then creating overridden subclasses. |
MethodBodyCreator |
getDefaultMethodOverride()
Returns the default MethodBodyCreator to use when creating overridden methods. |
protected void |
overrideAllMethods()
Calls overrideAllMethods(MethodBodyCreator) with the default MethodBodyCreator. |
protected void |
overrideAllMethods(MethodBodyCreator override)
Overrides all methods on the superclass with the exception of equals(Object), hashCode(),
toString() and finalize(). |
protected boolean |
overrideEquals()
Override the equals method using the default MethodBodyCreator. |
protected boolean |
overrideEquals(MethodBodyCreator creator)
Override the equals method using the given MethodBodyCreator. |
protected boolean |
overrideFinalize()
Override the finalize method using the default MethodBodyCreator. |
protected boolean |
overrideFinalize(MethodBodyCreator creator)
Override the finalize method using the given MethodBodyCreator. |
protected boolean |
overrideHashcode()
Override the hashCode method using the default MethodBodyCreator. |
protected boolean |
overrideHashcode(MethodBodyCreator creator)
Override the hashCode method using the given MethodBodyCreator. |
protected boolean |
overrideMethod(org.jboss.classfilewriter.ClassMethod method,
MethodIdentifier identifier,
MethodBodyCreator creator)
Creates a new method on the generated class that overrides the given methods, unless a method with the same signature has already been overridden. |
protected boolean |
overrideMethod(Method method,
MethodIdentifier identifier,
MethodBodyCreator creator)
Creates a new method on the generated class that overrides the given methods, unless a method with the same signature has already been overridden. |
protected void |
overridePublicMethods()
Overrides all public methods on the superclass. |
protected void |
overridePublicMethods(MethodBodyCreator override)
Overrides all public methods on the superclass. |
protected boolean |
overrideToString()
Override the toString method using the default MethodBodyCreator |
protected boolean |
overrideToString(MethodBodyCreator creator)
Override the toString method using the given MethodBodyCreator. |
| Methods inherited from class org.jboss.invocation.proxy.AbstractClassFactory |
|---|
afterClassLoad, buildClassDefinition, defineClass, generateClass, getClassLoader, getClassName, getProtectionDomain, getSuperClass, getSuperClassName, isProxyClassDefined, isProxyClassDefined, newInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final ReflectionMetadataSource reflectionMetadataSource
| Constructor Detail |
|---|
protected AbstractSubclassFactory(String className,
Class<T> superClass,
ClassLoader classLoader,
ProtectionDomain protectionDomain,
ReflectionMetadataSource reflectionMetadataSource)
className - the class namesuperClass - the superclassclassLoader - the defining class loaderprotectionDomain - the protection domain| Method Detail |
|---|
protected boolean overrideMethod(Method method,
MethodIdentifier identifier,
MethodBodyCreator creator)
method - The method to overrideidentifier - The identifier of the method to overridecreator - The MethodBodyCreator used to create the method body
true if the method was successfully overridden, false otherwise
protected boolean overrideMethod(org.jboss.classfilewriter.ClassMethod method,
MethodIdentifier identifier,
MethodBodyCreator creator)
method - The method to overrideidentifier - The identifier of the method to overridecreator - The MethodBodyCreator used to create the method body
false if the method has already been overriddenprotected void overridePublicMethods()
MethodBodyCreator is used to generate the class body.
NOTE: This will not override equals(Object), hashCode(), finalize() and
toString(), these should be overridden separately using overrideEquals(MethodBodyCreator)
overrideHashcode(MethodBodyCreator)overrideToString(MethodBodyCreator)
overrideFinalize(MethodBodyCreator)
protected void cleanup()
cleanup in class AbstractClassFactory<T>protected void overridePublicMethods(MethodBodyCreator override)
MethodBodyCreator is used to generate the class body.
NOTE: This will not override equals(Object), hashCode(), finalize() and
toString(), these should be overridden separately using overrideEquals(MethodBodyCreator)
overrideHashcode(MethodBodyCreator),overrideToString(MethodBodyCreator) and
overrideFinalize(MethodBodyCreator)
override - the method body creator to useprotected void overrideAllMethods()
overrideAllMethods(MethodBodyCreator) with the default MethodBodyCreator.
protected void overrideAllMethods(MethodBodyCreator override)
equals(Object), hashCode(),
toString() and finalize(). The given MethodBodyCreator is used to generate the class
body.
Note that private methods are not actually overridden, and if the sub-class is loaded by a different ClassLoader to the
parent class then neither will package-private methods. These methods will still be present on the new class however, and
can be accessed via reflection
override - the method body creator to useprotected boolean overrideEquals()
MethodBodyCreator.
protected boolean overrideEquals(MethodBodyCreator creator)
MethodBodyCreator.
creator - the method body creator to use
protected boolean overrideHashcode()
MethodBodyCreator.
protected boolean overrideHashcode(MethodBodyCreator creator)
MethodBodyCreator.
creator - the method body creator to use
protected boolean overrideToString()
MethodBodyCreator
protected boolean overrideToString(MethodBodyCreator creator)
MethodBodyCreator.
creator - the method body creator to use
protected boolean overrideFinalize()
MethodBodyCreator.
protected boolean overrideFinalize(MethodBodyCreator creator)
MethodBodyCreator.
creator - the method body creator to useprotected boolean addInterface(Class<?> interfaceClass)
MethodBodyCreator to generate the method bodies.
interfaceClass - the interface to add
protected boolean addInterface(MethodBodyCreator override,
Class<?> interfaceClass)
MethodBodyCreator to generate the method bodies
override - the method body creator to useinterfaceClass - the interface to add
protected void createConstructorDelegates()
ConstructorBodyCreator
protected void createConstructorDelegates(ConstructorBodyCreator creator)
creator - the constructor body creator to usepublic MethodBodyCreator getDefaultMethodOverride()
MethodBodyCreator to use when creating overridden methods.
public ConstructorBodyCreator getDefaultConstructorOverride()
ConstructorBodyCreator to use then creating overridden subclasses.
|
Invocation API 1.1.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||