org.datanucleus.enhancer.asm
Class ASMUtils

java.lang.Object
  extended by org.datanucleus.enhancer.asm.ASMUtils

public final class ASMUtils
extends Object

Utility class for ASM. ASM operates around two basic pieces of information about any type.


Field Summary
static String ACN_boolean
          ASM class name for boolean.
static String ACN_Boolean
          ASM class name for Boolean.
static String ACN_byte
          ASM class name for byte.
static String ACN_Byte
          ASM class name for Byte.
static String ACN_char
          ASM class name for char.
static String ACN_Character
          ASM class name for Character.
static String ACN_double
          ASM class name for double.
static String ACN_Double
          ASM class name for Double.
static String ACN_float
          ASM class name for float.
static String ACN_Float
          ASM class name for Float.
static String ACN_int
          ASM class name for int.
static String ACN_Integer
          ASM class name for Integer.
static String ACN_long
          ASM class name for long.
static String ACN_Long
          ASM class name for Long.
static String ACN_Object
          ASM class name for java.lang.Object.
static String ACN_short
          ASM class name for short.
static String ACN_Short
          ASM class name for Short.
static String ACN_String
          ASM class name for java.lang.String.
static String CD_Object
          Descriptor for java.lang.Object.
static String CD_String
          Class descriptor for String.
protected static org.datanucleus.util.Localiser LOCALISER
          Localiser for messages.
 
Method Summary
static void addBIPUSHToMethod(org.objectweb.asm.MethodVisitor visitor, int i)
          Convenience method to add a BIPUSH-type int to the visitor.
static void addLoadForType(org.objectweb.asm.MethodVisitor visitor, Class type, int number)
          Convenience method to add a load statement based on the type to be loaded.
static void addReturnForType(org.objectweb.asm.MethodVisitor visitor, Class type)
          Convenience method to add a return statement based on the type to be returned.
static String getASMClassNameForSingleFieldIdentityConstructor(Class fieldType)
          Convenience method to return the ASM class name to use as input via the SingleFieldIdentity constructor.
static String getTypeDescriptorForJDOMethod(Class cls)
          Convenience method to give the descriptor for use in a JDO "field" method.
static String getTypeDescriptorForType(String clsName)
          Return the ASM type descriptor for the input class.
static String getTypeNameForJDOMethod(Class cls)
          Convenience method to give the JDO method name given the type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static org.datanucleus.util.Localiser LOCALISER
Localiser for messages.


ACN_boolean

public static final String ACN_boolean
ASM class name for boolean.


ACN_byte

public static final String ACN_byte
ASM class name for byte.


ACN_char

public static final String ACN_char
ASM class name for char.


ACN_double

public static final String ACN_double
ASM class name for double.


ACN_float

public static final String ACN_float
ASM class name for float.


ACN_int

public static final String ACN_int
ASM class name for int.


ACN_long

public static final String ACN_long
ASM class name for long.


ACN_short

public static final String ACN_short
ASM class name for short.


ACN_Boolean

public static final String ACN_Boolean
ASM class name for Boolean.


ACN_Byte

public static final String ACN_Byte
ASM class name for Byte.


ACN_Character

public static final String ACN_Character
ASM class name for Character.


ACN_Double

public static final String ACN_Double
ASM class name for Double.


ACN_Float

public static final String ACN_Float
ASM class name for Float.


ACN_Integer

public static final String ACN_Integer
ASM class name for Integer.


ACN_Long

public static final String ACN_Long
ASM class name for Long.


ACN_Short

public static final String ACN_Short
ASM class name for Short.


ACN_String

public static final String ACN_String
ASM class name for java.lang.String.


ACN_Object

public static final String ACN_Object
ASM class name for java.lang.Object.


CD_String

public static final String CD_String
Class descriptor for String.


CD_Object

public static final String CD_Object
Descriptor for java.lang.Object.

Method Detail

addBIPUSHToMethod

public static void addBIPUSHToMethod(org.objectweb.asm.MethodVisitor visitor,
                                     int i)
Convenience method to add a BIPUSH-type int to the visitor.

Parameters:
visitor - The MethodVisitor
i - number

addReturnForType

public static void addReturnForType(org.objectweb.asm.MethodVisitor visitor,
                                    Class type)
Convenience method to add a return statement based on the type to be returned.

Parameters:
visitor - The MethodVisitor
type - The type to return

addLoadForType

public static void addLoadForType(org.objectweb.asm.MethodVisitor visitor,
                                  Class type,
                                  int number)
Convenience method to add a load statement based on the type to be loaded.

Parameters:
visitor - The MethodVisitor
type - The type to load
number - Number to load

getTypeNameForJDOMethod

public static String getTypeNameForJDOMethod(Class cls)
Convenience method to give the JDO method name given the type. This is for the assorted methods on the JDO StateManager called things like "replacingStringField", "replacingObjectField", "providedIntField", etc. Just returns the "type" part of the name.

Parameters:
cls - The type of the field
Returns:
Name for the method

getTypeDescriptorForType

public static String getTypeDescriptorForType(String clsName)
Return the ASM type descriptor for the input class.

Parameters:
clsName - The input class name
Returns:
The ASM type descriptor name

getTypeDescriptorForJDOMethod

public static String getTypeDescriptorForJDOMethod(Class cls)
Convenience method to give the descriptor for use in a JDO "field" method. This is for the assorted methods on the JDO StateManager called things like "replacingStringField", "replacingObjectField", "providedIntField", etc. Returns the ASM descriptor equivalent for the method used TODO Cache these descriptors/classes etc

Parameters:
cls - The type of the field
Returns:
Name for the method

getASMClassNameForSingleFieldIdentityConstructor

public static String getASMClassNameForSingleFieldIdentityConstructor(Class fieldType)
Convenience method to return the ASM class name to use as input via the SingleFieldIdentity constructor. Means that if the fieldType is primitive we return the ASM class name of the object wrapper.

Parameters:
fieldType - Type of the field
Returns:
ASM class name to use as input in the constructor


Copyright © 2012. All Rights Reserved.