Class AsmUtil
java.lang.Object
org.jboss.resteasy.reactive.common.processor.AsmUtil
A collection of ASM and Jandex utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetLoadOpcode(org.jboss.jandex.Type jandexType) Returns the bytecode instruction to load the given Jandex Type.static intgetNullValueOpcode(org.jboss.jandex.Type jandexType) Returns a null value suitable for initialising variables to null or its equivalent for primitivesstatic intgetParameterSize(org.jboss.jandex.Type paramType) Returns the number of underlying bytecode parameters taken by the given Jandex parameter Type.static StringgetSignature(org.jboss.jandex.Type type) static StringgetSignature(org.jboss.jandex.Type type, Function<String, org.jboss.jandex.Type> typeVariableSubstitution) static intgetStoreOpcode(org.jboss.jandex.Type jandexType) Returns the bytecode instruction to store the given Jandex Type.static voidunboxIfRequired(org.objectweb.asm.MethodVisitor mv, org.jboss.jandex.Type jandexType) Calls the right unboxing method for the given Jandex Type if it is a primitive.static voidunboxIfRequired(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type type) Calls the right unboxing method for the given Jandex Type if it is a primitive.
-
Constructor Details
-
AsmUtil
public AsmUtil()
-
-
Method Details
-
getSignature
-
getSignature
-
unboxIfRequired
public static void unboxIfRequired(org.objectweb.asm.MethodVisitor mv, org.jboss.jandex.Type jandexType) Calls the right unboxing method for the given Jandex Type if it is a primitive.- Parameters:
mv- The MethodVisitor on which to visit the unboxing instructionsjandexType- The Jandex Type to unbox if it is a primitive.
-
unboxIfRequired
public static void unboxIfRequired(org.objectweb.asm.MethodVisitor mv, org.objectweb.asm.Type type) Calls the right unboxing method for the given Jandex Type if it is a primitive.- Parameters:
mv- The MethodVisitor on which to visit the unboxing instructionstype- The Jandex Type to unbox if it is a primitive.
-
getLoadOpcode
public static int getLoadOpcode(org.jboss.jandex.Type jandexType) Returns the bytecode instruction to load the given Jandex Type. This returns the specialised bytecodes ILOAD, DLOAD, FLOAD and LLOAD for primitives, or ALOAD otherwise.- Parameters:
jandexType- The Jandex Type whose load instruction to return.- Returns:
- The bytecode instruction to load the given Jandex Type.
-
getStoreOpcode
public static int getStoreOpcode(org.jboss.jandex.Type jandexType) Returns the bytecode instruction to store the given Jandex Type. This returns the specialised bytecodes ISTORE, DSTORE, FSTORE and LSTORE for primitives, or ASTORE otherwise.- Parameters:
jandexType- The Jandex Type whose store instruction to return.- Returns:
- The bytecode instruction to store the given Jandex Type.
-
getNullValueOpcode
public static int getNullValueOpcode(org.jboss.jandex.Type jandexType) Returns a null value suitable for initialising variables to null or its equivalent for primitives -
getParameterSize
public static int getParameterSize(org.jboss.jandex.Type paramType) Returns the number of underlying bytecode parameters taken by the given Jandex parameter Type. This will be 2 for doubles and longs, 1 otherwise.- Parameters:
paramType- the Jandex parameter Type- Returns:
- the number of underlying bytecode parameters required.
-