attrib4j.bcel
Class DescriptorUtil

java.lang.Object
  |
  +--attrib4j.bcel.DescriptorUtil

public class DescriptorUtil
extends java.lang.Object

The signature of a method that is available from the BCEL library uses descriptors as defined in Section 4.3 of the Java Virtual Machine specificaiton. Javadoc and Java do not use signatures in this same format. This class converts the Javadoc/Java signature format to that used by the JVM spec. To summarize the descriptors A method descriptor represents the parameters that the method takes and the value that it returns: MethodDescriptor: ( ParameterDescriptor* ) ReturnDescriptor A parameter descriptor represents a parameter passed to a method: ParameterDescriptor: FieldType A return descriptor represents the type of the value returned from a method. It is a series of characters generated by the grammar: ReturnDescriptor: FieldType V The character V indicates that the method returns no value (its return type is void). A field descriptor represents the type of a class, instance, or local variable. It is a series of characters generated by the grammar: FieldDescriptor: FieldType ComponentType: FieldType FieldType: BaseType ObjectType ArrayType BaseType: B C D F I J S Z ObjectType: L ; ArrayType: [ ComponentType The characters of BaseType, the L and ; of ObjectType, and the [ of ArrayType are all ASCII characters. The represents a fully qualified class or interface name. For historical reasons it is encoded in internal form (4.2). The interpretation of the field types is as shown in Table 4.2. BaseType Character Type Interpretation ---------------------------------------------- B byte signed byte C char Unicode character D double double-precision floating-point value F float single-precision floating-point value I int integer J long long integer L; reference an instance of class S short signed short Z boolean true or false [ reference one array dimension

Author:
Mark Pollack

Constructor Summary
DescriptorUtil()
           
 
Method Summary
static java.lang.String convert(java.lang.String javadocSig, java.lang.String javadocReturnType)
          Converts from the Java/Javadoc method signature the JVM spec format.
static java.lang.String[] convertToJavaFormat(java.lang.String bcelSignature)
          Convert a method signature as definedin the JVM spec to that used in the Javadoc API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DescriptorUtil

public DescriptorUtil()
Method Detail

convert

public static java.lang.String convert(java.lang.String javadocSig,
                                       java.lang.String javadocReturnType)
Converts from the Java/Javadoc method signature the JVM spec format. TODO This class is poorly implemented and the code base no longer depends on it. Think about removing it.

Parameters:
javadocSig - method signature as returned via Javadoc API.
javadocReturnType - return type as returned via Javadoc API.
Returns:
mtehod signature as defined in the JVM spec.

convertToJavaFormat

public static java.lang.String[] convertToJavaFormat(java.lang.String bcelSignature)
Convert a method signature as definedin the JVM spec to that used in the Javadoc API. The BCEL library gives method signatures in the JVM format.

Parameters:
bcelSignature - The JVM format of a method signature.
Returns:
a String[] containing the method parameter as elements of the array.


Copyright © 2002-2003 Mark Pollack. All Rights Reserved.