com.deltax.util
Class SignatureAnalyzer

java.lang.Object
  extended bycom.deltax.util.SignatureAnalyzer

public class SignatureAnalyzer
extends java.lang.Object

A class to analyze a Java method signature declaration, returning information on type names.

When returning information, the class may or may not consider primitive types, arrays, or both. If primitive types are returned, the returned type names may include char, boolean, etc. If arrays are considered, the returned type names may have [] qualifications.

Version:
1.0
Author:
cris

Constructor Summary
SignatureAnalyzer(java.lang.String signature)
          Create an analyzer for the given signature, which returns both primitive and array type names
SignatureAnalyzer(java.lang.String signature, boolean excludePrimitive, boolean excludeArrays)
          Create an analyzer for the given signature.
 
Method Summary
 int countParameters()
          Return the number of (considered) parameters in the signature
static char getInternalPrimitiveTypeDescriptor(java.lang.String javaType)
          Return the internal type descriptor name for an java primitive type
static java.lang.String getJavaPrimitiveTypeName(char primitiveTypeDescriptor)
          Return the java name for an internal type descriptor of primitive type * @param primitiveTypeDescriptor the internal primitive type descriptor * @return the java name for an internal type descriptor of primitive type
static java.lang.String getJavaTypeName(java.lang.Class cls)
           
static java.lang.String getJavaTypeName(java.lang.String typeDescriptor)
          Return the java name for an internal type descriptor of primitive, array or object type * @param typeDescriptor the internal type descriptor * @return the externalized name for the type descriptor
static java.lang.Class getPrimitiveTypeClass(java.lang.String javaPrimitiveTypeName)
           
 java.lang.String getReturnTypeName()
          Return name of the method's return type.
static java.lang.Class getTypeClass(java.lang.String javaType)
           
 boolean hasMoreParameters()
          Return true if nextParameterTypeName() has more parameters to return
static boolean isPrimitiveTypeName(java.lang.String javaTypeName)
           
 java.lang.String nextParameterTypeName()
          Return the type name of the next parameter in the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignatureAnalyzer

public SignatureAnalyzer(java.lang.String signature,
                         boolean excludePrimitive,
                         boolean excludeArrays)
Create an analyzer for the given signature.

Parameters:
signature - the method signature to analyze, in internal form
excludePrimitive - if true, primitive types will be discarded
excludeArrays - if true only the component type of array types will be included in the type information

SignatureAnalyzer

public SignatureAnalyzer(java.lang.String signature)
Create an analyzer for the given signature, which returns both primitive and array type names

Parameters:
signature - the method signature to analyze, in internal form
Method Detail

getReturnTypeName

public java.lang.String getReturnTypeName()
Return name of the method's return type. If primitive types are excluded at construction, and the method's return type is primitive, will return null. If only array component types are to be considered (as declared at construction), and the method's return type is an array, the array's element type will be returned (or null if it's primitive and primitive types are excluded).

Returns:
name of the method's return type, or null

countParameters

public int countParameters()
Return the number of (considered) parameters in the signature

Returns:
int the number of (considered) parameters in the signature

hasMoreParameters

public boolean hasMoreParameters()
Return true if nextParameterTypeName() has more parameters to return

Returns:
true if nextParameterTypeName() has more parameters to return

nextParameterTypeName

public java.lang.String nextParameterTypeName()
Return the type name of the next parameter in the list. Depending on construction settings, primitive types may be excluded and array types may the component type name only.

Returns:
the type name of the next parameter in the list

getJavaPrimitiveTypeName

public static java.lang.String getJavaPrimitiveTypeName(char primitiveTypeDescriptor)
Return the java name for an internal type descriptor of primitive type * @param primitiveTypeDescriptor the internal primitive type descriptor * @return the java name for an internal type descriptor of primitive type


getInternalPrimitiveTypeDescriptor

public static char getInternalPrimitiveTypeDescriptor(java.lang.String javaType)
Return the internal type descriptor name for an java primitive type

Parameters:
javaType - the internal primitive type descriptor
Returns:
the java name for an internal type descriptor of primitive type

getJavaTypeName

public static java.lang.String getJavaTypeName(java.lang.String typeDescriptor)
Return the java name for an internal type descriptor of primitive, array or object type * @param typeDescriptor the internal type descriptor * @return the externalized name for the type descriptor


getJavaTypeName

public static java.lang.String getJavaTypeName(java.lang.Class cls)

getTypeClass

public static java.lang.Class getTypeClass(java.lang.String javaType)
                                    throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getPrimitiveTypeClass

public static java.lang.Class getPrimitiveTypeClass(java.lang.String javaPrimitiveTypeName)

isPrimitiveTypeName

public static boolean isPrimitiveTypeName(java.lang.String javaTypeName)