Package net.minidev.asm
Class ASMUtil
- java.lang.Object
-
- net.minidev.asm.ASMUtil
-
public class ASMUtil extends java.lang.ObjectASM Utils used to simplify class generation
-
-
Constructor Summary
Constructors Constructor Description ASMUtil()default constructor
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidautoBoxing(org.objectweb.asm.MethodVisitor mv, java.lang.Class<?> clz)Append the call of proper autoboxing method for the given primitive type.protected static voidautoBoxing(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type fieldType)Append the call of proper autoboxing method for the given primitive type.protected static voidautoUnBoxing1(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type fieldType)Append the call of proper extract primitive type of an boxed object.protected static voidautoUnBoxing2(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type fieldType)Append the call of proper extract primitive type of an boxed object.static Accessor[]getAccessors(java.lang.Class<?> type, FieldFilter filter)Extract all Accessor for the field of the given class.static java.lang.StringgetGetterName(java.lang.String key)Generates a getter method name for a given field name.static java.lang.StringgetIsName(java.lang.String key)Generates a boolean getter method name (is-method) for a given field name.static java.lang.StringgetSetterName(java.lang.String key)Generates a setter method name for a given field name.static org.objectweb.asm.Label[]newLabels(int cnt)return a array of new Label (used for switch/case generation)
-
-
-
Method Detail
-
autoBoxing
public static void autoBoxing(org.objectweb.asm.MethodVisitor mv, java.lang.Class<?> clz)Append the call of proper autoboxing method for the given primitive type.- Parameters:
mv- MethodVisitorclz- expected class
-
getAccessors
public static Accessor[] getAccessors(java.lang.Class<?> type, FieldFilter filter)
Extract all Accessor for the field of the given class.- Parameters:
type- typefilter- FieldFilter- Returns:
- all Accessor available
-
autoBoxing
protected static void autoBoxing(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type fieldType)Append the call of proper autoboxing method for the given primitive type.- Parameters:
mv- MethodVisitorfieldType- expected class
-
autoUnBoxing1
protected static void autoUnBoxing1(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type fieldType)Append the call of proper extract primitive type of an boxed object.- Parameters:
mv- MethodVisitorfieldType- expected class
-
autoUnBoxing2
protected static void autoUnBoxing2(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type fieldType)Append the call of proper extract primitive type of an boxed object. this method use Number interface to unbox object- Parameters:
mv- MethodVisitorfieldType- expected class
-
newLabels
public static org.objectweb.asm.Label[] newLabels(int cnt)
return a array of new Label (used for switch/case generation)- Parameters:
cnt- number of label to return- Returns:
- a Label array
-
getSetterName
public static java.lang.String getSetterName(java.lang.String key)
Generates a setter method name for a given field name.- Parameters:
key- the field name- Returns:
- setter name
-
getGetterName
public static java.lang.String getGetterName(java.lang.String key)
Generates a getter method name for a given field name.- Parameters:
key- the field name- Returns:
- getter name
-
getIsName
public static java.lang.String getIsName(java.lang.String key)
Generates a boolean getter method name (is-method) for a given field name.- Parameters:
key- the boolean field name- Returns:
- boolean getter name
-
-