com.caucho.ejb.gen
Class NonBusinessMethodGenerator<X>

java.lang.Object
  extended by com.caucho.ejb.gen.NonBusinessMethodGenerator<X>
All Implemented Interfaces:
AspectGenerator<X>

@Module
public class NonBusinessMethodGenerator<X>
extends java.lang.Object
implements AspectGenerator<X>

Represents a non-business method that is package accessible. XXX extend NullGenerator?


Constructor Summary
NonBusinessMethodGenerator(AnnotatedMethod<? super X> method)
           
 
Method Summary
 void generate(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> prologueMap)
          Top-level generator.
 void generateApplicationException(JavaWriter out, java.lang.Class<?> exn)
          Generates code for an application (checked) exception.
 void generateAsync(JavaWriter out)
           
 void generateBeanConstructor(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates initialization in the constructor
 void generateBeanPrologue(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates the static class prologue
 void generateCall(JavaWriter out)
          Generates code for the invocation itself.
 void generateDestroy(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates destroy code
 void generateEpilogue(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates epilogue
 void generateFinally(JavaWriter out)
          Generates the code in the finally block
 void generateInject(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates initialization in the constructor
 void generateMethodPrologue(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates the static class prologue
 void generatePostCall(JavaWriter out)
          Generates aspect code after the invocation.
 void generatePostConstruct(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates @PostConstruct code
 void generatePostFinally(JavaWriter out)
          Generates finally code for the method
 void generatePreCall(JavaWriter out)
          Generates code in the "try" block before the call
 void generatePreDestroy(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates @PreDestroy code
 void generatePreTry(JavaWriter out)
          Generates code before the "try" block
 void generateProxyConstructor(JavaWriter out, java.util.HashMap<java.lang.String,java.lang.Object> map)
          Generates initialization in the proxy constructor
 void generateSystemException(JavaWriter out, java.lang.Class<?> exn)
          Generates system (runtime) exception code for the method.
protected  java.lang.reflect.Method getJavaMethod()
          Returns the JavaMethod for this aspect.
 AnnotatedMethod<? super X> getMethod()
          Returns the underlying method.
protected  java.lang.Class<?>[] getThrowsExceptions()
           
protected  java.util.Set<VarType<?>> getTypeVariables()
           
 boolean isApplicationExceptionThrown()
          Returns true if the application exception can be thrown.
protected  boolean isOverride()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NonBusinessMethodGenerator

public NonBusinessMethodGenerator(AnnotatedMethod<? super X> method)
Method Detail

isOverride

protected boolean isOverride()

getMethod

public AnnotatedMethod<? super X> getMethod()
Description copied from interface: AspectGenerator
Returns the underlying method.

Specified by:
getMethod in interface AspectGenerator<X>

getTypeVariables

protected java.util.Set<VarType<?>> getTypeVariables()

getJavaMethod

protected java.lang.reflect.Method getJavaMethod()
Returns the JavaMethod for this aspect.


getThrowsExceptions

protected java.lang.Class<?>[] getThrowsExceptions()

generate

public void generate(JavaWriter out,
                     java.util.HashMap<java.lang.String,java.lang.Object> prologueMap)
              throws java.io.IOException
Top-level generator.

Specified by:
generate in interface AspectGenerator<X>
Throws:
java.io.IOException

generateBeanPrologue

public void generateBeanPrologue(JavaWriter out,
                                 java.util.HashMap<java.lang.String,java.lang.Object> map)
                          throws java.io.IOException
Generates the static class prologue

Specified by:
generateBeanPrologue in interface AspectGenerator<X>
Throws:
java.io.IOException

generateBeanConstructor

public void generateBeanConstructor(JavaWriter out,
                                    java.util.HashMap<java.lang.String,java.lang.Object> map)
                             throws java.io.IOException
Generates initialization in the constructor

Specified by:
generateBeanConstructor in interface AspectGenerator<X>
Throws:
java.io.IOException

generateInject

public void generateInject(JavaWriter out,
                           java.util.HashMap<java.lang.String,java.lang.Object> map)
                    throws java.io.IOException
Generates initialization in the constructor

Specified by:
generateInject in interface AspectGenerator<X>
Throws:
java.io.IOException

generateProxyConstructor

public void generateProxyConstructor(JavaWriter out,
                                     java.util.HashMap<java.lang.String,java.lang.Object> map)
                              throws java.io.IOException
Generates initialization in the proxy constructor

Specified by:
generateProxyConstructor in interface AspectGenerator<X>
Throws:
java.io.IOException

generatePostConstruct

public void generatePostConstruct(JavaWriter out,
                                  java.util.HashMap<java.lang.String,java.lang.Object> map)
                           throws java.io.IOException
Generates @PostConstruct code

Specified by:
generatePostConstruct in interface AspectGenerator<X>
Throws:
java.io.IOException

generatePreDestroy

public void generatePreDestroy(JavaWriter out,
                               java.util.HashMap<java.lang.String,java.lang.Object> map)
                        throws java.io.IOException
Description copied from interface: AspectGenerator
Generates @PreDestroy code

Specified by:
generatePreDestroy in interface AspectGenerator<X>
Throws:
java.io.IOException

generateEpilogue

public void generateEpilogue(JavaWriter out,
                             java.util.HashMap<java.lang.String,java.lang.Object> map)
                      throws java.io.IOException
Description copied from interface: AspectGenerator
Generates epilogue

Specified by:
generateEpilogue in interface AspectGenerator<X>
Throws:
java.io.IOException

generateDestroy

public void generateDestroy(JavaWriter out,
                            java.util.HashMap<java.lang.String,java.lang.Object> map)
                     throws java.io.IOException
Generates destroy code

Specified by:
generateDestroy in interface AspectGenerator<X>
Throws:
java.io.IOException

generateMethodPrologue

public void generateMethodPrologue(JavaWriter out,
                                   java.util.HashMap<java.lang.String,java.lang.Object> map)
                            throws java.io.IOException
Generates the static class prologue

Specified by:
generateMethodPrologue in interface AspectGenerator<X>
Throws:
java.io.IOException

generateAsync

public void generateAsync(JavaWriter out)
                   throws java.io.IOException
Specified by:
generateAsync in interface AspectGenerator<X>
Throws:
java.io.IOException

generatePreTry

public void generatePreTry(JavaWriter out)
                    throws java.io.IOException
Generates code before the "try" block
 retType myMethod(...)
 {
   [pre-try]
   try {
     ...
 }
 

Specified by:
generatePreTry in interface AspectGenerator<X>
Throws:
java.io.IOException

generatePreCall

public void generatePreCall(JavaWriter out)
                     throws java.io.IOException
Generates code in the "try" block before the call
 retType myMethod(...)
 {
   ...
   try {
     [pre-call]
     ret = super.myMethod(...)
     ...
 }
 

Specified by:
generatePreCall in interface AspectGenerator<X>
Throws:
java.io.IOException

generateCall

public void generateCall(JavaWriter out)
                  throws java.io.IOException
Generates code for the invocation itself.

Specified by:
generateCall in interface AspectGenerator<X>
Throws:
java.io.IOException

generatePostCall

public void generatePostCall(JavaWriter out)
                      throws java.io.IOException
Generates aspect code after the invocation.
 retType myMethod(...)
 {
   ...
   try {
     ...
     ret = super.myMethod(...)
     [post-call]
     return ret;
   } finally {
     ...
   }
 }
 

Specified by:
generatePostCall in interface AspectGenerator<X>
Throws:
java.io.IOException

isApplicationExceptionThrown

public boolean isApplicationExceptionThrown()
Description copied from interface: AspectGenerator
Returns true if the application exception can be thrown.

Specified by:
isApplicationExceptionThrown in interface AspectGenerator<X>

generateApplicationException

public void generateApplicationException(JavaWriter out,
                                         java.lang.Class<?> exn)
                                  throws java.io.IOException
Generates code for an application (checked) exception.

Specified by:
generateApplicationException in interface AspectGenerator<X>
Throws:
java.io.IOException

generateSystemException

public void generateSystemException(JavaWriter out,
                                    java.lang.Class<?> exn)
                             throws java.io.IOException
Generates system (runtime) exception code for the method.

Specified by:
generateSystemException in interface AspectGenerator<X>
Throws:
java.io.IOException

generateFinally

public void generateFinally(JavaWriter out)
                     throws java.io.IOException
Generates the code in the finally block
 myRet myMethod(...)
 {
   try {
     ...
   } finally {
     [finally]
   }
 

Specified by:
generateFinally in interface AspectGenerator<X>
Throws:
java.io.IOException

generatePostFinally

public void generatePostFinally(JavaWriter out)
                         throws java.io.IOException
Description copied from interface: AspectGenerator
Generates finally code for the method
 retType myMethod(...)
 {
   try {
     ...
     value = bean.myMethod(...);
     ...
     return value;
   } finally {
     ...
   }
   [post-finally]
 }
 

Specified by:
generatePostFinally in interface AspectGenerator<X>
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object