Class ASMUtil

java.lang.Object
net.minidev.asm.ASMUtil

public class ASMUtil extends Object
ASM Utils used to simplify class generation
Author:
uriel Chemouni
  • Constructor Summary

    Constructors
    Constructor
    Description
    default constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    autoBoxing(org.objectweb.asm.MethodVisitor mv, Class<?> clz)
    Append the call of proper autoboxing method for the given primitive type.
    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.
    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.
    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.
    static Accessor[]
    getAccessors(Class<?> type, FieldFilter filter)
    Extract all Accessor for the field of the given class.
    static String
    Generates a getter method name for a given field name.
    static String
    Generates a boolean getter method name (is-method) for a given field name.
    static String
    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)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ASMUtil

      public ASMUtil()
      default constructor
  • Method Details

    • autoBoxing

      public static void autoBoxing(org.objectweb.asm.MethodVisitor mv, Class<?> clz)
      Append the call of proper autoboxing method for the given primitive type.
      Parameters:
      mv - MethodVisitor
      clz - expected class
    • getAccessors

      public static Accessor[] getAccessors(Class<?> type, FieldFilter filter)
      Extract all Accessor for the field of the given class.
      Parameters:
      type - type
      filter - 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 - MethodVisitor
      fieldType - 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 - MethodVisitor
      fieldType - 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 - MethodVisitor
      fieldType - 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 String getSetterName(String key)
      Generates a setter method name for a given field name.
      Parameters:
      key - the field name
      Returns:
      setter name
    • getGetterName

      public static String getGetterName(String key)
      Generates a getter method name for a given field name.
      Parameters:
      key - the field name
      Returns:
      getter name
    • getIsName

      public static String getIsName(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