com.mchange.v2.codegen.intfc
Class DelegatorGenerator

java.lang.Object
  extended by com.mchange.v2.codegen.intfc.DelegatorGenerator

public class DelegatorGenerator
extends java.lang.Object


Constructor Summary
DelegatorGenerator()
           
 
Method Summary
protected  void generateBannerComment(IndentedWriter iw)
           
protected  void generateClassJavaDocComment(IndentedWriter iw)
           
protected  void generateDelegateCode(java.lang.Class intfcl, java.lang.String genclass, java.lang.reflect.Method method, IndentedWriter iw)
           
protected  void generateExtraDeclarations(java.lang.Class intfcl, java.lang.String genclass, IndentedWriter iw)
           
protected  void generateExtraImports(IndentedWriter iw)
           
protected  void generatePostDelegateCode(java.lang.Class intfcl, java.lang.String genclass, java.lang.reflect.Method method, IndentedWriter iw)
           
protected  void generatePreDelegateCode(java.lang.Class intfcl, java.lang.String genclass, java.lang.reflect.Method method, IndentedWriter iw)
           
protected  void generateReflectiveDelegateCode(java.lang.Class intfcl, java.lang.String genclass, java.lang.reflect.Method method, IndentedWriter iw)
           
 int getClassModifiers()
           
 java.lang.Class[] getExtraInterfaces()
           
 int getMethodModifiers()
           
 int getNoArgConstructorModifiers()
           
 java.lang.reflect.Method[] getReflectiveDelegateMethods()
           
 ReflectiveDelegationPolicy getReflectiveDelegationPolicy()
           
 java.lang.Class getSuperclass()
           
 int getWrappingConstructorModifiers()
           
 boolean isGenerateInnerGetter()
           
 boolean isGenerateInnerSetter()
           
 boolean isGenerateNoArgConstructor()
           
 boolean isGenerateWrappingConstructor()
           
 void setClassModifiers(int modifiers)
           
 void setExtraInterfaces(java.lang.Class[] extraInterfaces)
           
 void setGenerateInnerGetter(boolean b)
           
 void setGenerateInnerSetter(boolean b)
           
 void setGenerateNoArgConstructor(boolean b)
           
 void setGenerateWrappingConstructor(boolean b)
           
 void setMethodModifiers(int modifiers)
           
 void setNoArgConstructorModifiers(int modifiers)
           
 void setReflectiveDelegateMethods(java.lang.reflect.Method[] reflectiveDelegateMethods)
          Reflectively delegated methods are methods that are not declared in the interface at build time, but that should reflectively be forwarded at runtime to the inner delegate.
 void setReflectiveDelegationPolicy(ReflectiveDelegationPolicy reflectiveDelegationPolicy)
          If ReflectiveDelegationPolicy.USE_MAIN_DELEGATE_INTERFACE, delegate via the same interface we are generating methods against.
 void setSuperclass(java.lang.Class superclass)
           
 void setWrappingConstructorModifiers(int modifiers)
           
 void writeDelegator(java.lang.Class intfcl, java.lang.String genclass, java.io.Writer w)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatorGenerator

public DelegatorGenerator()
Method Detail

setGenerateInnerSetter

public void setGenerateInnerSetter(boolean b)

isGenerateInnerSetter

public boolean isGenerateInnerSetter()

setGenerateInnerGetter

public void setGenerateInnerGetter(boolean b)

isGenerateInnerGetter

public boolean isGenerateInnerGetter()

setGenerateNoArgConstructor

public void setGenerateNoArgConstructor(boolean b)

isGenerateNoArgConstructor

public boolean isGenerateNoArgConstructor()

setGenerateWrappingConstructor

public void setGenerateWrappingConstructor(boolean b)

isGenerateWrappingConstructor

public boolean isGenerateWrappingConstructor()

setWrappingConstructorModifiers

public void setWrappingConstructorModifiers(int modifiers)

getWrappingConstructorModifiers

public int getWrappingConstructorModifiers()

setNoArgConstructorModifiers

public void setNoArgConstructorModifiers(int modifiers)

getNoArgConstructorModifiers

public int getNoArgConstructorModifiers()

setMethodModifiers

public void setMethodModifiers(int modifiers)

getMethodModifiers

public int getMethodModifiers()

setClassModifiers

public void setClassModifiers(int modifiers)

getClassModifiers

public int getClassModifiers()

setSuperclass

public void setSuperclass(java.lang.Class superclass)

getSuperclass

public java.lang.Class getSuperclass()

setExtraInterfaces

public void setExtraInterfaces(java.lang.Class[] extraInterfaces)

getExtraInterfaces

public java.lang.Class[] getExtraInterfaces()

getReflectiveDelegateMethods

public java.lang.reflect.Method[] getReflectiveDelegateMethods()

setReflectiveDelegateMethods

public void setReflectiveDelegateMethods(java.lang.reflect.Method[] reflectiveDelegateMethods)
Reflectively delegated methods are methods that are not declared in the interface at build time, but that should reflectively be forwarded at runtime to the inner delegate. This permits support of public methods not exposed via the interface, or support of methods added to versions of the interface newer than the build version. Note that the declaring class of these methods is simply ignored. Methods will ve delegated solely by name and parameter.


getReflectiveDelegationPolicy

public ReflectiveDelegationPolicy getReflectiveDelegationPolicy()

setReflectiveDelegationPolicy

public void setReflectiveDelegationPolicy(ReflectiveDelegationPolicy reflectiveDelegationPolicy)
If ReflectiveDelegationPolicy.USE_MAIN_DELEGATE_INTERFACE, delegate via the same interface we are generating methods against. (This is useful for supporting methods in versions of the interface with methods that don't appear in the version we are generating against.) If ReflectiveDelegationPolicy.USE_RUNTIME_CLASS, delegate via the runtime class of the delegate. (This is useful if the methods come from multiple interfaces, or we want to be able to forward to methods of the delegate class not captured by an interface. Otherwise, use the delegateClass set in the constructor of ReflectiveDelegationPolicy. Note that if the delegate class is not public or otherwise accessible to the generated proxy, IllegalAccessExceptions may ensue.


writeDelegator

public void writeDelegator(java.lang.Class intfcl,
                           java.lang.String genclass,
                           java.io.Writer w)
                    throws java.io.IOException
Throws:
java.io.IOException

generateDelegateCode

protected void generateDelegateCode(java.lang.Class intfcl,
                                    java.lang.String genclass,
                                    java.lang.reflect.Method method,
                                    IndentedWriter iw)
                             throws java.io.IOException
Throws:
java.io.IOException

generateReflectiveDelegateCode

protected void generateReflectiveDelegateCode(java.lang.Class intfcl,
                                              java.lang.String genclass,
                                              java.lang.reflect.Method method,
                                              IndentedWriter iw)
                                       throws java.io.IOException
Throws:
java.io.IOException

generateBannerComment

protected void generateBannerComment(IndentedWriter iw)
                              throws java.io.IOException
Throws:
java.io.IOException

generateClassJavaDocComment

protected void generateClassJavaDocComment(IndentedWriter iw)
                                    throws java.io.IOException
Throws:
java.io.IOException

generateExtraImports

protected void generateExtraImports(IndentedWriter iw)
                             throws java.io.IOException
Throws:
java.io.IOException

generatePreDelegateCode

protected void generatePreDelegateCode(java.lang.Class intfcl,
                                       java.lang.String genclass,
                                       java.lang.reflect.Method method,
                                       IndentedWriter iw)
                                throws java.io.IOException
Throws:
java.io.IOException

generatePostDelegateCode

protected void generatePostDelegateCode(java.lang.Class intfcl,
                                        java.lang.String genclass,
                                        java.lang.reflect.Method method,
                                        IndentedWriter iw)
                                 throws java.io.IOException
Throws:
java.io.IOException

generateExtraDeclarations

protected void generateExtraDeclarations(java.lang.Class intfcl,
                                         java.lang.String genclass,
                                         IndentedWriter iw)
                                  throws java.io.IOException
Throws:
java.io.IOException