Class InitClass

java.lang.Object
org.datanucleus.enhancer.ClassMethod
org.datanucleus.enhancer.methods.InitClass

public class InitClass extends ClassMethod
Method to generate a static initialisation block for the class using ASM.
 static
 {
     dnFieldNames = __dnFieldNamesInit();
     dnInheritedFieldCount = __dnGetInheritedFieldCount();

     EnhancementHelper.registerClass(___dn$loadClass("mydomain.MyClass"), new MyClass());
 }
 
  • Constructor Details

    • InitClass

      public InitClass(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames)
      Constructor.
      Parameters:
      enhancer - ClassEnhancer
      name - Name of method
      access - Access type
      returnType - Return type
      argTypes - Argument types
      argNames - Argument names
  • Method Details

    • getInstance

      public static InitClass getInstance(ClassEnhancer enhancer)
    • execute

      public void execute()
      Method to add the contents of the class method.
      Specified by:
      execute in class ClassMethod
    • addInitialiseInstructions

      public void addInitialiseInstructions(MethodVisitor mv)
      Convenience method to add the initialise instructions to the supplied MethodVisitor. Available as a separate method so that the initialise instructions can be added to an existing static class initialise block (where the class already has one).
      Parameters:
      mv - MethodVisitor to use