classfilewriter 1.0.0.Final

org.jboss.classfilewriter.util
Class DescriptorUtils

java.lang.Object
  extended by org.jboss.classfilewriter.util.DescriptorUtils

public class DescriptorUtils
extends Object

Utility class for working with method descriptors

Author:
Stuart Douglas

Constructor Summary
DescriptorUtils()
           
 
Method Summary
static boolean isPrimitive(String descriptor)
          returns true if the descriptor represents a primitive type
static boolean isWide(Class<?> cls)
          returns true if the class represents a long or a double
static boolean isWide(String descriptor)
          returns true if the descriptor represents a long or a double
static String makeDescriptor(Class<?> c)
           
static String makeDescriptor(Constructor<?> c)
           
static String makeDescriptor(String className)
          Changes a class name to the internal form suitable for use in a descriptor string.
static String methodDescriptor(Method m)
           
static String methodDescriptor(String[] parameters, String returnType)
           
static String[] parameterDescriptors(Class<?>[] parameters)
           
static String[] parameterDescriptors(Method m)
           
static String[] parameterDescriptors(String methodDescriptor)
          returns an array of String representations of the parameter types.
static String returnType(String methodDescriptor)
           
static String validateDescriptor(String descriptor)
          performs basic validation on a descriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DescriptorUtils

public DescriptorUtils()
Method Detail

makeDescriptor

public static String makeDescriptor(String className)
Changes a class name to the internal form suitable for use in a descriptor string. e.g. java.lang.String => Ljava/lang/String;


makeDescriptor

public static String makeDescriptor(Class<?> c)

makeDescriptor

public static String makeDescriptor(Constructor<?> c)

parameterDescriptors

public static String[] parameterDescriptors(String methodDescriptor)
returns an array of String representations of the parameter types. Primitives are returned as their native representations, while clases are returned in the internal descriptor form e.g. Ljava/lang/Integer;


parameterDescriptors

public static String[] parameterDescriptors(Method m)

parameterDescriptors

public static String[] parameterDescriptors(Class<?>[] parameters)

returnType

public static String returnType(String methodDescriptor)

isPrimitive

public static boolean isPrimitive(String descriptor)
returns true if the descriptor represents a primitive type


isWide

public static boolean isWide(String descriptor)
returns true if the descriptor represents a long or a double


isWide

public static boolean isWide(Class<?> cls)
returns true if the class represents a long or a double


methodDescriptor

public static String methodDescriptor(Method m)

methodDescriptor

public static String methodDescriptor(String[] parameters,
                                      String returnType)

validateDescriptor

public static String validateDescriptor(String descriptor)
performs basic validation on a descriptor


classfilewriter 1.0.0.Final

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.