Class AsmUtil
- java.lang.Object
-
- org.jboss.resteasy.reactive.common.processor.AsmUtil
-
public class AsmUtil extends Object
A collection of ASM and Jandex utilities. NOTE: this has a copy in AsmUtilCopy in arc-processor with some extra methods for knowing if we need a signature and getting the signature of a class.
-
-
Constructor Summary
Constructors Constructor Description AsmUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetDescriptor(org.jboss.jandex.MethodInfo method, Function<String,String> typeArgMapper)Returns the Java bytecode descriptor of a given Jandex MethodInfo using the given type argument mappings.static StringgetDescriptor(org.jboss.jandex.Type type, Function<String,String> typeArgMapper)Returns the Java bytecode descriptor of a given Jandex Type using the given type argument mappings.static StringgetSignature(org.jboss.jandex.Type type, Function<String,String> typeArgMapper)Returns the Java bytecode signature of a given Jandex Type using the given type argument mappings.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.
-
-
-
Method Detail
-
getDescriptor
public static String getDescriptor(org.jboss.jandex.MethodInfo method, Function<String,String> typeArgMapper)
Returns the Java bytecode descriptor of a given Jandex MethodInfo using the given type argument mappings. For example, given this method:
This will return (ILjava/lang/Integer;)Ljava/util/List; if yourpublic class Foo<T> { public <R> List<R> method(int a, T t){...} }typeArgMappercontainsT=Ljava/lang/Integer;.- Parameters:
method- the method you want the descriptor for.typeArgMapper- a mapping between type argument names and their bytecode descriptor.- Returns:
- a bytecode descriptor for that method.
-
getDescriptor
public static String getDescriptor(org.jboss.jandex.Type type, Function<String,String> typeArgMapper)
Returns the Java bytecode descriptor of a given Jandex Type using the given type argument mappings. For example, given this type: List<T>, this will return Ljava/util/List; if yourtypeArgMappercontainsT=Ljava/lang/Integer;.- Parameters:
type- the type you want the descriptor for.typeArgMapper- a mapping between type argument names and their bytecode descriptor.- Returns:
- a bytecode descriptor for that type.
-
getSignature
public static String getSignature(org.jboss.jandex.Type type, Function<String,String> typeArgMapper)
Returns the Java bytecode signature of a given Jandex Type using the given type argument mappings. For example, given this type: List<T>, this will return Ljava/util/List<Ljava/lang/Integer;>; if yourtypeArgMappercontainsT=Ljava/lang/Integer;.- Parameters:
type- the type you want the signature for.typeArgMapper- a mapping between type argument names and their bytecode descriptor.- Returns:
- a bytecode signature for that type.
-
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.
-
-