Package org.jboss.classfilewriter.util

## Class DescriptorUtils

- java.lang.Object
- - org.jboss.classfilewriter.util.DescriptorUtils

    public class DescriptorUtils
    extends java.lang.Object

Utility class for working with method descriptors

Author:
  Stuart Douglas

### Constructor Summary

Constructors
`DescriptorUtils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static boolean` `isPrimitive​(java.lang.String descriptor)` returns true if the descriptor represents a primitive type
`static boolean` `isWide​(java.lang.Class<?> cls)` returns true if the class represents a long or a double
`static boolean` `isWide​(java.lang.String descriptor)` returns true if the descriptor represents a long or a double
`static java.lang.String` `makeDescriptor​(java.lang.Class<?> c)`
`static java.lang.String` `makeDescriptor​(java.lang.reflect.Constructor<?> c)`
`static java.lang.String` `makeDescriptor​(java.lang.String className)` Changes a class name to the internal form suitable for use in a descriptor string.
`static java.lang.String` `methodDescriptor​(java.lang.reflect.Method m)`
`static java.lang.String` `methodDescriptor​(java.lang.String[] parameters, java.lang.String returnType)`
`static java.lang.String[]` `parameterDescriptors​(java.lang.Class<?>[] parameters)`
`static java.lang.String[]` `parameterDescriptors​(java.lang.reflect.Method m)`
`static java.lang.String[]` `parameterDescriptors​(java.lang.String methodDescriptor)` returns an array of String representations of the parameter types.
`static java.lang.String` `returnType​(java.lang.String methodDescriptor)`
`static java.lang.String` `validateDescriptor​(java.lang.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 java.lang.String makeDescriptor​(java.lang.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 java.lang.String makeDescriptor​(java.lang.Class<?> c)

#### makeDescriptor

    public static java.lang.String makeDescriptor​(java.lang.reflect.Constructor<?> c)

#### parameterDescriptors

    public static java.lang.String[] parameterDescriptors​(java.lang.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 java.lang.String[] parameterDescriptors​(java.lang.reflect.Method m)

#### parameterDescriptors

    public static java.lang.String[] parameterDescriptors​(java.lang.Class<?>[] parameters)

#### returnType

    public static java.lang.String returnType​(java.lang.String methodDescriptor)

#### isPrimitive

    public static boolean isPrimitive​(java.lang.String descriptor)

returns true if the descriptor represents a primitive type

#### isWide

    public static boolean isWide​(java.lang.String descriptor)

returns true if the descriptor represents a long or a double

#### isWide

    public static boolean isWide​(java.lang.Class<?> cls)

returns true if the class represents a long or a double

#### methodDescriptor

    public static java.lang.String methodDescriptor​(java.lang.reflect.Method m)

#### methodDescriptor

    public static java.lang.String methodDescriptor​(java.lang.String[] parameters,
                                                    java.lang.String returnType)

#### validateDescriptor

    public static java.lang.String validateDescriptor​(java.lang.String descriptor)

performs basic validation on a descriptor