org.datanucleus.enhancer.asm
Class ASMUtils

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

public final class ASMUtils
extends java.lang.Object

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


Field Summary
static java.lang.String ACN_boolean
          ASM class name for boolean.
static java.lang.String ACN_Boolean
          ASM class name for Boolean.
static java.lang.String ACN_byte
          ASM class name for byte.
static java.lang.String ACN_Byte
          ASM class name for Byte.
static java.lang.String ACN_char
          ASM class name for char.
static java.lang.String ACN_Character
          ASM class name for Character.
static java.lang.String ACN_Detachable
          ASM class name for javax.jdo.spi.Detachable.
static java.lang.String ACN_double
          ASM class name for double.
static java.lang.String ACN_Double
          ASM class name for Double.
static java.lang.String ACN_float
          ASM class name for float.
static java.lang.String ACN_Float
          ASM class name for Float.
static java.lang.String ACN_int
          ASM class name for int.
static java.lang.String ACN_Integer
          ASM class name for Integer.
static java.lang.String ACN_JDOPermission
          ASM class name for javax.jdo.spi.JDOPermission.
static java.lang.String ACN_long
          ASM class name for long.
static java.lang.String ACN_Long
          ASM class name for Long.
static java.lang.String ACN_Object
          ASM class name for java.lang.Object.
static java.lang.String ACN_PersistenceCapable
          ASM class name for javax.jdo.spi.PersistenceCapable.
static java.lang.String ACN_PersistenceManager
          ASM class name for javax.jdo.PersistenceManager.
static java.lang.String ACN_SecurityManager
          ASM class name for java.lang.SecurityManager.
static java.lang.String ACN_short
          ASM class name for short.
static java.lang.String ACN_Short
          ASM class name for Short.
static java.lang.String ACN_StateManager
          ASM class name for javax.jdo.spi.StateManager.
static java.lang.String ACN_String
          ASM class name for java.lang.String.
static java.lang.String CD_ByteIdentity
          Descriptor for ByteIdentity.
static java.lang.String CD_CharIdentity
          Descriptor for CharIdentity.
static java.lang.String CD_Detachable
          Descriptor for javax.jdo.spi.Detachable.
static java.lang.String CD_IntIdentity
          Descriptor for IntIdentity.
static java.lang.String CD_LongIdentity
          Descriptor for LongIdentity.
static java.lang.String CD_Object
          Descriptor for java.lang.Object.
static java.lang.String CD_ObjectIdentity
          Descriptor for ObjectIdentity.
static java.lang.String CD_ObjectIdFieldConsumer
          Descriptor for PersistenceCapable$ObjectIdFieldConsumer.
static java.lang.String CD_ObjectIdFieldSupplier
          Descriptor for PersistenceCapable$ObjectIdFieldConsumer.
static java.lang.String CD_PersistenceCapable
          Descriptor for javax.jdo.spi.PersistenceCapable.
static java.lang.String CD_PersistenceManager
          Descriptor for javax.jdo.PersistenceManager.
static java.lang.String CD_SecurityManager
          Descriptor for java.lang.SecurityManager.
static java.lang.String CD_ShortIdentity
          Descriptor for ShortIdentity.
static java.lang.String CD_StateManager
          Descriptor for javax.jdo.spi.StateManager.
static java.lang.String CD_String
          Class descriptor for String.
static java.lang.String CD_StringIdentity
          Descriptor for StringIdentity.
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, java.lang.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, java.lang.Class type)
          Convenience method to add a return statement based on the type to be returned.
static java.lang.String getASMClassNameForSingleFieldIdentityConstructor(java.lang.Class fieldType)
          Convenience method to return the ASM class name to use as input via the SingleFieldIdentity constructor.
static java.lang.String getSingleFieldIdentityDescriptor(java.lang.String oidClassName)
          Accessor for the descriptor for a SingleFieldIdentity type.
static java.lang.String getTypeDescriptorForJDOMethod(java.lang.Class cls)
          Convenience method to give the descriptor for use in a JDO "field" method.
static java.lang.String getTypeDescriptorForSingleFieldIdentityGetKey(java.lang.String oidClassName)
          Accessor for the descriptor for the return type from SingleFieldIdentity.getKey() for the passed identity class name.
static java.lang.String getTypeDescriptorForType(java.lang.String clsName)
          Return the ASM type descriptor for the input class.
static java.lang.String getTypeNameForJDOMethod(java.lang.Class cls)
          Convenience method to give the JDO method name given the type.
static java.lang.String getTypeNameForUseWithSingleFieldIdentity(java.lang.String oidClassName)
          Convenience method to give the JDO method type name for a singleFieldIdentity class name.
 
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 java.lang.String ACN_boolean
ASM class name for boolean.


ACN_byte

public static final java.lang.String ACN_byte
ASM class name for byte.


ACN_char

public static final java.lang.String ACN_char
ASM class name for char.


ACN_double

public static final java.lang.String ACN_double
ASM class name for double.


ACN_float

public static final java.lang.String ACN_float
ASM class name for float.


ACN_int

public static final java.lang.String ACN_int
ASM class name for int.


ACN_long

public static final java.lang.String ACN_long
ASM class name for long.


ACN_short

public static final java.lang.String ACN_short
ASM class name for short.


ACN_Boolean

public static final java.lang.String ACN_Boolean
ASM class name for Boolean.


ACN_Byte

public static final java.lang.String ACN_Byte
ASM class name for Byte.


ACN_Character

public static final java.lang.String ACN_Character
ASM class name for Character.


ACN_Double

public static final java.lang.String ACN_Double
ASM class name for Double.


ACN_Float

public static final java.lang.String ACN_Float
ASM class name for Float.


ACN_Integer

public static final java.lang.String ACN_Integer
ASM class name for Integer.


ACN_Long

public static final java.lang.String ACN_Long
ASM class name for Long.


ACN_Short

public static final java.lang.String ACN_Short
ASM class name for Short.


ACN_String

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


ACN_Object

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


ACN_StateManager

public static final java.lang.String ACN_StateManager
ASM class name for javax.jdo.spi.StateManager.


ACN_PersistenceManager

public static final java.lang.String ACN_PersistenceManager
ASM class name for javax.jdo.PersistenceManager.


ACN_PersistenceCapable

public static final java.lang.String ACN_PersistenceCapable
ASM class name for javax.jdo.spi.PersistenceCapable.


ACN_Detachable

public static final java.lang.String ACN_Detachable
ASM class name for javax.jdo.spi.Detachable.


ACN_JDOPermission

public static final java.lang.String ACN_JDOPermission
ASM class name for javax.jdo.spi.JDOPermission.


ACN_SecurityManager

public static final java.lang.String ACN_SecurityManager
ASM class name for java.lang.SecurityManager.


CD_String

public static final java.lang.String CD_String
Class descriptor for String.


CD_Object

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


CD_ByteIdentity

public static final java.lang.String CD_ByteIdentity
Descriptor for ByteIdentity.


CD_CharIdentity

public static final java.lang.String CD_CharIdentity
Descriptor for CharIdentity.


CD_IntIdentity

public static final java.lang.String CD_IntIdentity
Descriptor for IntIdentity.


CD_LongIdentity

public static final java.lang.String CD_LongIdentity
Descriptor for LongIdentity.


CD_ShortIdentity

public static final java.lang.String CD_ShortIdentity
Descriptor for ShortIdentity.


CD_StringIdentity

public static final java.lang.String CD_StringIdentity
Descriptor for StringIdentity.


CD_ObjectIdentity

public static final java.lang.String CD_ObjectIdentity
Descriptor for ObjectIdentity.


CD_StateManager

public static final java.lang.String CD_StateManager
Descriptor for javax.jdo.spi.StateManager.


CD_PersistenceManager

public static final java.lang.String CD_PersistenceManager
Descriptor for javax.jdo.PersistenceManager.


CD_PersistenceCapable

public static final java.lang.String CD_PersistenceCapable
Descriptor for javax.jdo.spi.PersistenceCapable.


CD_Detachable

public static final java.lang.String CD_Detachable
Descriptor for javax.jdo.spi.Detachable.


CD_SecurityManager

public static final java.lang.String CD_SecurityManager
Descriptor for java.lang.SecurityManager.


CD_ObjectIdFieldConsumer

public static final java.lang.String CD_ObjectIdFieldConsumer
Descriptor for PersistenceCapable$ObjectIdFieldConsumer.


CD_ObjectIdFieldSupplier

public static final java.lang.String CD_ObjectIdFieldSupplier
Descriptor for PersistenceCapable$ObjectIdFieldConsumer.

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,
                                    java.lang.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,
                                  java.lang.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 java.lang.String getTypeNameForJDOMethod(java.lang.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 java.lang.String getTypeDescriptorForType(java.lang.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 java.lang.String getTypeDescriptorForJDOMethod(java.lang.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

getTypeDescriptorForSingleFieldIdentityGetKey

public static java.lang.String getTypeDescriptorForSingleFieldIdentityGetKey(java.lang.String oidClassName)
Accessor for the descriptor for the return type from SingleFieldIdentity.getKey() for the passed identity class name.

Parameters:
oidClassName - Name of the SingleFieldIdentity class
Returns:
The descriptor of the return type from getKey

getSingleFieldIdentityDescriptor

public static java.lang.String getSingleFieldIdentityDescriptor(java.lang.String oidClassName)
Accessor for the descriptor for a SingleFieldIdentity type.

Parameters:
oidClassName - Name of the SingleFieldIdentity class
Returns:
The descriptor of the SingleFieldIdentity type

getTypeNameForUseWithSingleFieldIdentity

public static java.lang.String getTypeNameForUseWithSingleFieldIdentity(java.lang.String oidClassName)
Convenience method to give the JDO method type name for a singleFieldIdentity class name. Used for jdoCopyKeyFields[To/From]ObjectId and defines the "type name" used for things like storeXXXField.

Parameters:
oidClassName - Name of the single field identity class
Returns:
Name for the method

getASMClassNameForSingleFieldIdentityConstructor

public static java.lang.String getASMClassNameForSingleFieldIdentityConstructor(java.lang.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 © 2011. All Rights Reserved.