Package com.mchange.v2.codegen.intfc
Class DelegatorGenerator
java.lang.Object
com.mchange.v2.codegen.intfc.DelegatorGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidgenerateDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) protected voidgenerateExtraDeclarations(Class intfcl, String genclass, IndentedWriter iw) protected voidprotected voidgeneratePostDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) protected voidgeneratePreDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) protected voidgenerateReflectiveDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) intClass[]intintMethod[]intbooleanbooleanbooleanbooleanvoidsetClassModifiers(int modifiers) voidsetExtraInterfaces(Class[] extraInterfaces) voidsetGenerateInnerGetter(boolean b) voidsetGenerateInnerSetter(boolean b) voidsetGenerateNoArgConstructor(boolean b) voidsetGenerateWrappingConstructor(boolean b) voidsetMethodModifiers(int modifiers) voidsetNoArgConstructorModifiers(int modifiers) voidsetReflectiveDelegateMethods(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.voidsetReflectiveDelegationPolicy(ReflectiveDelegationPolicy reflectiveDelegationPolicy) If ReflectiveDelegationPolicy.USE_MAIN_DELEGATE_INTERFACE, delegate via the same interface we are generating methods against.voidsetSuperclass(Class superclass) voidsetWrappingConstructorModifiers(int modifiers) voidwriteDelegator(Class intfcl, String genclass, Writer w)
-
Constructor Details
-
DelegatorGenerator
public DelegatorGenerator()
-
-
Method Details
-
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
-
getSuperclass
-
setExtraInterfaces
-
getExtraInterfaces
-
getReflectiveDelegateMethods
-
setReflectiveDelegateMethods
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
-
setReflectiveDelegationPolicy
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
- Throws:
IOException
-
generateDelegateCode
protected void generateDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException - Throws:
IOException
-
generateReflectiveDelegateCode
protected void generateReflectiveDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException - Throws:
IOException
-
generateBannerComment
- Throws:
IOException
-
generateClassJavaDocComment
- Throws:
IOException
-
generateExtraImports
- Throws:
IOException
-
generatePreDelegateCode
protected void generatePreDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException - Throws:
IOException
-
generatePostDelegateCode
protected void generatePostDelegateCode(Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException - Throws:
IOException
-
generateExtraDeclarations
protected void generateExtraDeclarations(Class intfcl, String genclass, IndentedWriter iw) throws IOException - Throws:
IOException
-