classUtils.pack.util
Class MethodSignatureAnalyzer

java.lang.Object
  extended by classUtils.pack.util.MethodSignatureAnalyzer

public class MethodSignatureAnalyzer
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
MethodSignatureAnalyzer(java.lang.String signature)
          Create an analyzer for the given signature, which returns both primitive and array type names
MethodSignatureAnalyzer(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
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
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodSignatureAnalyzer

public MethodSignatureAnalyzer(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

MethodSignatureAnalyzer

public MethodSignatureAnalyzer(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 affineTransform construction, and the method's return type is primitive, will return null. If only array component types are to be considered (as declared affineTransform 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

Parameters:
primitiveTypeDescriptor - the internal primitive type descriptor
Returns:
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

Parameters:
typeDescriptor - the internal type descriptor
Returns:
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)