cuba.util.codegen
Class ManagedAdapterGenerator

java.lang.Object
  extended by cuba.util.codegen.ManagedAdapterGenerator

public abstract class ManagedAdapterGenerator
extends java.lang.Object


Field Summary
protected  CUBAComponent component
           
protected  java.lang.Class externalInterface
           
protected  java.lang.String externalInterfacePackage
           
static java.util.Set immutableClasses
           
protected  java.lang.Class implClass
           
protected  java.lang.String implPackage
           
protected  java.lang.Class internalInterface
           
protected  java.lang.String internalInterfacePackage
           
static java.lang.String METHODPARAMNAME_PREFIX
           
static java.lang.String METHODRETURN
           
protected  AdapterGeneratorOptions options
           
 
Constructor Summary
protected ManagedAdapterGenerator(CUBAComponent component, java.lang.String internalInterfacePackage, java.lang.String externalInterfacePackage, java.lang.String implPackage, AdapterGeneratorOptions options)
           
 
Method Summary
protected  void checkSerializable(java.lang.Class type)
           
protected  void checkSignature(java.lang.reflect.Method method, boolean external)
           
protected  void collectForeignType(java.lang.String homePackage, java.util.HashSet types, java.lang.Class type)
           
protected abstract  GeneratorResult generate(GeneratorResult result)
           
protected  void generateCommonInterceptors(GeneratedFile adapter, java.util.Collection interceptors, java.util.Collection baseInterceptors)
           
protected  void generateCommonInterceptors(GeneratedFile adapter, CUBAComponent component)
           
protected  void generateComponentInjection(GeneratedFile adapter)
           
protected  void generateCoreMethodCall(GeneratedFile adapter, java.lang.String methodName, java.lang.Class[] paramTypes)
           
protected  void generateDependencyInjection(GeneratedFile adapter)
           
protected  void generateEntityManagerInjection(GeneratedFile adapter)
           
protected  void generateEnvironmentInjection(GeneratedFile adapter)
           
protected  void generateFileHeader(GeneratedFile adapter, java.lang.String info, java.lang.Class interfaceType)
           
protected  void generateInjectionStatement(GeneratedFile adapter, Reference ref, java.lang.String getter)
           
protected  void generateInterceptorHead(GeneratedFile adapter, java.lang.reflect.Method method, boolean privateInterceptors)
           
protected  void generateInterceptors(GeneratedFile adapter, java.util.Collection interceptors, java.lang.String interceptorType)
           
protected  void generateLifecycleMethodHeads(GeneratedFile adapter, java.lang.String[] callTypes)
           
protected  void generateLifecycleMethodInitializers(GeneratedFile adapter, java.lang.String[] callTypes)
           
protected  void generateLifecyleCall(GeneratedFile adapter, java.lang.String callType)
           
 void generateMethod(GeneratedFile adapter, java.lang.reflect.Method method, boolean external, boolean privateInterceptors)
           
protected  void generateMethodDeclarator(GeneratedFile adapter, java.lang.reflect.Method method, boolean remoteCapable)
           
protected  void generateMethodHead(GeneratedFile adapter, java.lang.reflect.Method method)
           
protected  void generateMethodInitializer(GeneratedFile adapter, java.lang.reflect.Method method)
           
protected  void generateMethods(GeneratedFile adapter, java.lang.reflect.Method[] methods, java.util.Set externalMethods, boolean privateInterceptors)
           
protected  void generatePostActivate(GeneratedFile adapter)
           
protected  void generatePostConstruct(GeneratedFile adapter)
           
protected  void generatePreDestroy(GeneratedFile adapter)
           
protected  void generatePrePassivate(GeneratedFile adapter)
           
protected  void generateResourceInjection(GeneratedFile adapter)
           
protected  java.lang.reflect.Method getMethod(java.lang.Class type, java.lang.String methodName, java.lang.Class[] paramTypes)
           
protected  java.lang.reflect.Method getMethod(java.lang.String typeName, java.lang.String methodName)
           
protected  java.lang.reflect.Method getMethod(java.lang.String typeName, java.lang.String methodName, java.lang.Class[] paramTypes)
           
protected  java.lang.String getSimpleTypeName(java.lang.Class type)
          Does the same as Class.getSimpleName() in Java 5.
protected  void insertCatchBlocks(GeneratedFile adapter, java.lang.reflect.Method method)
           
protected  void insertDeepCopy(GeneratedFile adapter, java.lang.reflect.Method method, boolean external)
           
protected  void insertParameterList(GeneratedFile adapter, java.lang.reflect.Method method)
           
protected  void insertReturnExpression(GeneratedFile adapter, java.lang.reflect.Method method)
           
protected  java.lang.String interceptorMemberName(java.lang.reflect.Method method)
           
protected  boolean isVoid(java.lang.reflect.Method method)
           
protected  java.lang.String methodMemberName(java.lang.reflect.Method method)
           
protected  boolean needsCopy(java.lang.Class type)
          Check if objects of the specified type need to be copied when being passed by value to another function.
protected  GeneratedFile open(java.lang.String basename)
           
protected  GeneratedFile open(java.lang.String basename, java.lang.String packageName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

immutableClasses

public static java.util.Set immutableClasses

METHODPARAMNAME_PREFIX

public static final java.lang.String METHODPARAMNAME_PREFIX
See Also:
Constant Field Values

METHODRETURN

public static final java.lang.String METHODRETURN
See Also:
Constant Field Values

component

protected CUBAComponent component

externalInterface

protected java.lang.Class externalInterface

internalInterface

protected java.lang.Class internalInterface

implClass

protected java.lang.Class implClass

externalInterfacePackage

protected java.lang.String externalInterfacePackage

internalInterfacePackage

protected java.lang.String internalInterfacePackage

implPackage

protected java.lang.String implPackage

options

protected AdapterGeneratorOptions options
Constructor Detail

ManagedAdapterGenerator

protected ManagedAdapterGenerator(CUBAComponent component,
                                  java.lang.String internalInterfacePackage,
                                  java.lang.String externalInterfacePackage,
                                  java.lang.String implPackage,
                                  AdapterGeneratorOptions options)
                           throws GeneratorException
Throws:
GeneratorException
Method Detail

interceptorMemberName

protected java.lang.String interceptorMemberName(java.lang.reflect.Method method)

generateMethodHead

protected void generateMethodHead(GeneratedFile adapter,
                                  java.lang.reflect.Method method)

generateInterceptorHead

protected void generateInterceptorHead(GeneratedFile adapter,
                                       java.lang.reflect.Method method,
                                       boolean privateInterceptors)

generateInterceptors

protected void generateInterceptors(GeneratedFile adapter,
                                    java.util.Collection interceptors,
                                    java.lang.String interceptorType)
                             throws GeneratorException
Throws:
GeneratorException

generateCommonInterceptors

protected void generateCommonInterceptors(GeneratedFile adapter,
                                          java.util.Collection interceptors,
                                          java.util.Collection baseInterceptors)
                                   throws GeneratorException
Throws:
GeneratorException

generateCommonInterceptors

protected void generateCommonInterceptors(GeneratedFile adapter,
                                          CUBAComponent component)
                                   throws GeneratorException
Throws:
GeneratorException

generateMethodInitializer

protected void generateMethodInitializer(GeneratedFile adapter,
                                         java.lang.reflect.Method method)

generateLifecycleMethodInitializers

protected void generateLifecycleMethodInitializers(GeneratedFile adapter,
                                                   java.lang.String[] callTypes)
                                            throws GeneratorException
Throws:
GeneratorException

needsCopy

protected boolean needsCopy(java.lang.Class type)
Check if objects of the specified type need to be copied when being passed by value to another function. This is the case if the type is neither primitive nor immutable


insertDeepCopy

protected void insertDeepCopy(GeneratedFile adapter,
                              java.lang.reflect.Method method,
                              boolean external)

insertParameterList

protected void insertParameterList(GeneratedFile adapter,
                                   java.lang.reflect.Method method)

insertReturnExpression

protected void insertReturnExpression(GeneratedFile adapter,
                                      java.lang.reflect.Method method)

insertCatchBlocks

protected void insertCatchBlocks(GeneratedFile adapter,
                                 java.lang.reflect.Method method)

generateMethod

public void generateMethod(GeneratedFile adapter,
                           java.lang.reflect.Method method,
                           boolean external,
                           boolean privateInterceptors)
                    throws GeneratorException
Throws:
GeneratorException

generateLifecycleMethodHeads

protected void generateLifecycleMethodHeads(GeneratedFile adapter,
                                            java.lang.String[] callTypes)
                                     throws GeneratorException
Throws:
GeneratorException

generateMethods

protected void generateMethods(GeneratedFile adapter,
                               java.lang.reflect.Method[] methods,
                               java.util.Set externalMethods,
                               boolean privateInterceptors)
                        throws GeneratorException
Throws:
GeneratorException

open

protected GeneratedFile open(java.lang.String basename)
                      throws GeneratorException
Throws:
GeneratorException

open

protected GeneratedFile open(java.lang.String basename,
                             java.lang.String packageName)
                      throws GeneratorException
Throws:
GeneratorException

generateFileHeader

protected void generateFileHeader(GeneratedFile adapter,
                                  java.lang.String info,
                                  java.lang.Class interfaceType)

collectForeignType

protected void collectForeignType(java.lang.String homePackage,
                                  java.util.HashSet types,
                                  java.lang.Class type)

getSimpleTypeName

protected java.lang.String getSimpleTypeName(java.lang.Class type)
Does the same as Class.getSimpleName() in Java 5. The function appears here to keep the CUBA code compatible with JDK 1.4


checkSerializable

protected void checkSerializable(java.lang.Class type)
                          throws GeneratorException
Throws:
GeneratorException

checkSignature

protected void checkSignature(java.lang.reflect.Method method,
                              boolean external)
                       throws GeneratorException
Throws:
GeneratorException

getMethod

protected java.lang.reflect.Method getMethod(java.lang.Class type,
                                             java.lang.String methodName,
                                             java.lang.Class[] paramTypes)
                                      throws GeneratorException
Throws:
GeneratorException

getMethod

protected java.lang.reflect.Method getMethod(java.lang.String typeName,
                                             java.lang.String methodName,
                                             java.lang.Class[] paramTypes)
                                      throws GeneratorException
Throws:
GeneratorException

getMethod

protected java.lang.reflect.Method getMethod(java.lang.String typeName,
                                             java.lang.String methodName)
                                      throws GeneratorException
Throws:
GeneratorException

methodMemberName

protected java.lang.String methodMemberName(java.lang.reflect.Method method)

generateMethodDeclarator

protected void generateMethodDeclarator(GeneratedFile adapter,
                                        java.lang.reflect.Method method,
                                        boolean remoteCapable)
                                 throws GeneratorException
Throws:
GeneratorException

generateCoreMethodCall

protected void generateCoreMethodCall(GeneratedFile adapter,
                                      java.lang.String methodName,
                                      java.lang.Class[] paramTypes)

generateInjectionStatement

protected void generateInjectionStatement(GeneratedFile adapter,
                                          Reference ref,
                                          java.lang.String getter)

generateEnvironmentInjection

protected void generateEnvironmentInjection(GeneratedFile adapter)
                                     throws GeneratorException
Throws:
GeneratorException

generateResourceInjection

protected void generateResourceInjection(GeneratedFile adapter)
                                  throws GeneratorException
Throws:
GeneratorException

generateComponentInjection

protected void generateComponentInjection(GeneratedFile adapter)
                                   throws GeneratorException
Throws:
GeneratorException

generateEntityManagerInjection

protected void generateEntityManagerInjection(GeneratedFile adapter)
                                       throws GeneratorException
Throws:
GeneratorException

generateDependencyInjection

protected void generateDependencyInjection(GeneratedFile adapter)
                                    throws GeneratorException
Throws:
GeneratorException

generateLifecyleCall

protected void generateLifecyleCall(GeneratedFile adapter,
                                    java.lang.String callType)
                             throws GeneratorException
Throws:
GeneratorException

generatePreDestroy

protected void generatePreDestroy(GeneratedFile adapter)
                           throws GeneratorException
Throws:
GeneratorException

generatePostConstruct

protected void generatePostConstruct(GeneratedFile adapter)
                              throws GeneratorException
Throws:
GeneratorException

generatePrePassivate

protected void generatePrePassivate(GeneratedFile adapter)
                             throws GeneratorException
Throws:
GeneratorException

generatePostActivate

protected void generatePostActivate(GeneratedFile adapter)
                             throws GeneratorException
Throws:
GeneratorException

isVoid

protected boolean isVoid(java.lang.reflect.Method method)

generate

protected abstract GeneratorResult generate(GeneratorResult result)
                                     throws GeneratorException
Throws:
GeneratorException