Atavism Version 2018.1AGIS API

atavism.server.marshalling
Class InjectionGenerator

java.lang.Object
  extended by atavism.server.marshalling.InjectionGenerator

public class InjectionGenerator
extends java.lang.Object


Nested Class Summary
static class InjectionGenerator.BranchFixup
           
static class InjectionGenerator.PrimitiveTypeInfo
           
 
Field Summary
protected  boolean generateClassFiles
           
protected static InjectionGenerator instance
           
protected  boolean listGeneratedCode
           
protected  java.lang.String outputDir
           
protected static InjectionGenerator.PrimitiveTypeInfo[] primitiveTypes
           
 
Constructor Summary
InjectionGenerator(boolean generateClassFiles, java.lang.String outputDir, boolean listGeneratedCode)
          InjectionGenerator constructor
 
Method Summary
protected  void addAOByteBufferFieldGet(JavaClass clazz, Field f, Type fieldType, InjectionGenerator.PrimitiveTypeInfo info, InstructionFactory factory, InstructionList il)
           
protected  void addAOByteBufferFieldPut(JavaClass clazz, Field f, Type fieldType, InjectionGenerator.PrimitiveTypeInfo info, InstructionFactory factory, InstructionList il)
           
protected  void addFieldFetch(JavaClass clazz, InstructionFactory factory, Field f, InstructionList il)
           
protected  void addMarshallingForField(JavaClass clazz, Field f, InstructionFactory factory, InstructionList il)
           
protected  void addStack(int count)
           
protected  void addUnmarshallingForField(JavaClass clazz, Field f, InstructionFactory factory, ConstantPoolGen cp, InstructionList il)
           
protected  java.lang.String aggregateTypeString(ObjectType fieldObjectType)
           
protected  MethodGen createMarshallingMethod(JavaClass clazz, JavaClass superclass, ConstantPoolGen cp, InstructionFactory factory, java.util.LinkedList<Field> fields, java.util.LinkedList<java.lang.Integer> nullTestedFields, int flagBitCount)
          Create the marshalObject method
protected  MethodGen createUnmarshallingMethod(JavaClass clazz, JavaClass superclass, ConstantPoolGen cp, InstructionFactory factory, java.util.LinkedList<Field> fields, java.util.LinkedList<java.lang.Integer> nullTestedFields, int flagBitCount)
          Create the unmarshalObject method
protected  boolean doesOrWillHandleMarshallable(ObjectType type)
           
protected  java.lang.Short getAggregateTypeNum(ObjectType fieldObjectType)
           
protected  int getFinalStack()
           
static InjectionGenerator getInstance()
          Get the InjectionGenerator singleton instance
protected static InjectionGenerator.PrimitiveTypeInfo getPrimitiveTypeInfo(Type type)
           
protected static java.util.LinkedList<Field> getValidClassFields(JavaClass c)
           
static JavaClass getValidSuperclass(JavaClass c)
           
static boolean handlesMarshallable(JavaClass clazz)
           
protected  boolean handlesMarshallable(ObjectType type)
           
static void initialize(boolean generateClassFiles, java.lang.String outputDir, boolean listGeneratedCode)
           
protected  void initializeGlobals()
           
protected  void initStack()
           
protected  JavaClass injectMarshallingMethods(JavaClass clazz, JavaClass superclass, java.util.LinkedList<Field> fields, java.util.LinkedList<java.lang.Integer> nullTestedFields, int flagBitCount)
          Inject the marshalling methods for this class
static boolean interfaceClass(java.lang.String s)
           
protected static boolean isPrimitiveObjectType(Type type)
           
protected static boolean isPrimitiveType(Type type)
           
protected  boolean isStringType(Type type)
           
protected  void logGeneratedMethod(ClassGen classGen, MethodGen method)
           
protected static void logInvoke(java.lang.String s, InvokeInstruction iv, ConstantPoolGen cp)
           
protected static JavaClass lookupClass(java.lang.String className)
           
protected  InjectionGenerator.BranchFixup[] makeOmittedTest(JavaClass clazz, Field f, InstructionFactory factory, InstructionList il)
           
protected  boolean marshalledByMarshallingRuntimeMarshalObject(ObjectType fieldObjectType)
           
 JavaClass maybeInjectMarshalling(JavaClass clazz, java.lang.Short typeNum)
          This is the public method called by MarshallingRuntime to inject marshalling methods into the clazz argument
protected static java.lang.String nonPrimitiveObjectTypeName(Type type)
           
protected  void noteBranchTargets(InjectionGenerator.BranchFixup[] branchFixups, InstructionList il)
           
protected  boolean objectTypeIsInterface(ObjectType type)
           
protected  boolean referencesInterface(ObjectType type)
           
protected  Type storageType(Type type)
           
protected static void throwError(java.lang.String msg)
           
protected  Type underlyingPrimitiveType(Type type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generateClassFiles

protected boolean generateClassFiles

outputDir

protected java.lang.String outputDir

listGeneratedCode

protected boolean listGeneratedCode

primitiveTypes

protected static InjectionGenerator.PrimitiveTypeInfo[] primitiveTypes

instance

protected static InjectionGenerator instance
Constructor Detail

InjectionGenerator

public InjectionGenerator(boolean generateClassFiles,
                          java.lang.String outputDir,
                          boolean listGeneratedCode)
InjectionGenerator constructor

Parameters:
generateClassFiles - True if we should generate new class files containing injected methods. This is used by the batch injection code.
outputDir - If not the empty string, this is the directory in which generated class files should be stored.
listGeneratedCode - True if we should log the generated methods in the log file. This is only set when debugging InjectionGenerator.
Method Detail

getInstance

public static InjectionGenerator getInstance()
Get the InjectionGenerator singleton instance


maybeInjectMarshalling

public JavaClass maybeInjectMarshalling(JavaClass clazz,
                                        java.lang.Short typeNum)
This is the public method called by MarshallingRuntime to inject marshalling methods into the clazz argument

Parameters:
clazz - The BCEL JavaClass instance representing the class file
typeNum - The type number for the class
Returns:
The modified JavaClazz instance

injectMarshallingMethods

protected JavaClass injectMarshallingMethods(JavaClass clazz,
                                             JavaClass superclass,
                                             java.util.LinkedList<Field> fields,
                                             java.util.LinkedList<java.lang.Integer> nullTestedFields,
                                             int flagBitCount)
Inject the marshalling methods for this class


logGeneratedMethod

protected void logGeneratedMethod(ClassGen classGen,
                                  MethodGen method)

createMarshallingMethod

protected MethodGen createMarshallingMethod(JavaClass clazz,
                                            JavaClass superclass,
                                            ConstantPoolGen cp,
                                            InstructionFactory factory,
                                            java.util.LinkedList<Field> fields,
                                            java.util.LinkedList<java.lang.Integer> nullTestedFields,
                                            int flagBitCount)
Create the marshalObject method


addMarshallingForField

protected void addMarshallingForField(JavaClass clazz,
                                      Field f,
                                      InstructionFactory factory,
                                      InstructionList il)

addAOByteBufferFieldPut

protected void addAOByteBufferFieldPut(JavaClass clazz,
                                       Field f,
                                       Type fieldType,
                                       InjectionGenerator.PrimitiveTypeInfo info,
                                       InstructionFactory factory,
                                       InstructionList il)

makeOmittedTest

protected InjectionGenerator.BranchFixup[] makeOmittedTest(JavaClass clazz,
                                                           Field f,
                                                           InstructionFactory factory,
                                                           InstructionList il)

createUnmarshallingMethod

protected MethodGen createUnmarshallingMethod(JavaClass clazz,
                                              JavaClass superclass,
                                              ConstantPoolGen cp,
                                              InstructionFactory factory,
                                              java.util.LinkedList<Field> fields,
                                              java.util.LinkedList<java.lang.Integer> nullTestedFields,
                                              int flagBitCount)
Create the unmarshalObject method


addUnmarshallingForField

protected void addUnmarshallingForField(JavaClass clazz,
                                        Field f,
                                        InstructionFactory factory,
                                        ConstantPoolGen cp,
                                        InstructionList il)

addAOByteBufferFieldGet

protected void addAOByteBufferFieldGet(JavaClass clazz,
                                       Field f,
                                       Type fieldType,
                                       InjectionGenerator.PrimitiveTypeInfo info,
                                       InstructionFactory factory,
                                       InstructionList il)

addFieldFetch

protected void addFieldFetch(JavaClass clazz,
                             InstructionFactory factory,
                             Field f,
                             InstructionList il)

lookupClass

protected static JavaClass lookupClass(java.lang.String className)

getPrimitiveTypeInfo

protected static InjectionGenerator.PrimitiveTypeInfo getPrimitiveTypeInfo(Type type)

isStringType

protected boolean isStringType(Type type)

isPrimitiveObjectType

protected static boolean isPrimitiveObjectType(Type type)

isPrimitiveType

protected static boolean isPrimitiveType(Type type)

nonPrimitiveObjectTypeName

protected static java.lang.String nonPrimitiveObjectTypeName(Type type)

underlyingPrimitiveType

protected Type underlyingPrimitiveType(Type type)

storageType

protected Type storageType(Type type)

getAggregateTypeNum

protected java.lang.Short getAggregateTypeNum(ObjectType fieldObjectType)

aggregateTypeString

protected java.lang.String aggregateTypeString(ObjectType fieldObjectType)

marshalledByMarshallingRuntimeMarshalObject

protected boolean marshalledByMarshallingRuntimeMarshalObject(ObjectType fieldObjectType)

referencesInterface

protected boolean referencesInterface(ObjectType type)

doesOrWillHandleMarshallable

protected boolean doesOrWillHandleMarshallable(ObjectType type)

handlesMarshallable

protected boolean handlesMarshallable(ObjectType type)

handlesMarshallable

public static boolean handlesMarshallable(JavaClass clazz)

objectTypeIsInterface

protected boolean objectTypeIsInterface(ObjectType type)

interfaceClass

public static boolean interfaceClass(java.lang.String s)

getValidClassFields

protected static java.util.LinkedList<Field> getValidClassFields(JavaClass c)

getValidSuperclass

public static JavaClass getValidSuperclass(JavaClass c)

noteBranchTargets

protected void noteBranchTargets(InjectionGenerator.BranchFixup[] branchFixups,
                                 InstructionList il)

initStack

protected void initStack()

addStack

protected void addStack(int count)

getFinalStack

protected int getFinalStack()

logInvoke

protected static void logInvoke(java.lang.String s,
                                InvokeInstruction iv,
                                ConstantPoolGen cp)

throwError

protected static void throwError(java.lang.String msg)

initializeGlobals

protected void initializeGlobals()

initialize

public static void initialize(boolean generateClassFiles,
                              java.lang.String outputDir,
                              boolean listGeneratedCode)


Copyright © 2018 Dragonsan Studios Sp. z o.o.