org.metasyntactic.utilities
Class Signature

java.lang.Object
  |
  +--org.metasyntactic.utilities.Signature

public class Signature
extends java.lang.Object

A signature is a string representing a type of a method, field or array. The field signature represents the value of an argument to a function or the value of a variable. It is a series of bytes generated by the following grammar:

  ::= 
       ::= ||
        ::= B|C|D|F|I|J|S|Z
      ::= L;
       ::= [
    ::= [0-9]*
 
The meaning of the base types is as follows: A return-type signature represents the return value from a method. It is a series of bytes in the following grammar:
  ::=  | V
 
The character V indicates that the method returns no value. Otherwise, the signature indicates the type of the return value.

An argument signature represents an argument passed to a method:

  ::= 
 
A method signature represents the arguments that the method expects, and the value that it returns.
     ::= () 
  ::= *
 


Field Summary
static java.lang.String BOOLEAN_SIGNATURE
           
static java.lang.String BYTE_SIGNATURE
           
static java.lang.String CHAR_SIGNATURE
           
static java.lang.String DOUBLE_SIGNATURE
           
static java.lang.String FLOAT_SIGNATURE
           
static java.lang.String INT_SIGNATURE
           
static java.lang.String LONG_SIGNATURE
           
static java.lang.String SHORT_SIGNATURE
           
static java.lang.String VOID_SIGNATURE
           
 
Constructor Summary
Signature()
           
 
Method Summary
static java.lang.String getSignature(java.lang.Class clazz)
          Returns the appropriate signature string for this class
static java.lang.String getSignature(java.lang.reflect.Constructor cons)
           
static java.lang.String getSignature(java.lang.reflect.Method method)
           
static void main(java.lang.String[] args)
           
static java.lang.String toString(java.lang.String sig)
          Converts a java VM signature into it's appropriate java code String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN_SIGNATURE

public static final java.lang.String BOOLEAN_SIGNATURE
See Also:
Constant Field Values

BYTE_SIGNATURE

public static final java.lang.String BYTE_SIGNATURE
See Also:
Constant Field Values

SHORT_SIGNATURE

public static final java.lang.String SHORT_SIGNATURE
See Also:
Constant Field Values

CHAR_SIGNATURE

public static final java.lang.String CHAR_SIGNATURE
See Also:
Constant Field Values

INT_SIGNATURE

public static final java.lang.String INT_SIGNATURE
See Also:
Constant Field Values

LONG_SIGNATURE

public static final java.lang.String LONG_SIGNATURE
See Also:
Constant Field Values

FLOAT_SIGNATURE

public static final java.lang.String FLOAT_SIGNATURE
See Also:
Constant Field Values

DOUBLE_SIGNATURE

public static final java.lang.String DOUBLE_SIGNATURE
See Also:
Constant Field Values

VOID_SIGNATURE

public static final java.lang.String VOID_SIGNATURE
See Also:
Constant Field Values
Constructor Detail

Signature

public Signature()
Method Detail

getSignature

public static java.lang.String getSignature(java.lang.Class clazz)
Returns the appropriate signature string for this class

Returns:
The signature for this class

getSignature

public static java.lang.String getSignature(java.lang.reflect.Constructor cons)

getSignature

public static java.lang.String getSignature(java.lang.reflect.Method method)

toString

public static java.lang.String toString(java.lang.String sig)
                                 throws java.lang.IllegalArgumentException
Converts a java VM signature into it's appropriate java code String. Examples:

Parameters:
sig - The signature to convert to a java code snippet
Returns:
The java code version of this VM type signature
Throws:
java.lang.IllegalArgumentException - If the signature is not a valid VM type signature

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments