com.claritysys.jvm.disassembler
Class Signature

java.lang.Object
  extended by com.claritysys.jvm.disassembler.Signature

public final class Signature
extends java.lang.Object

A parser for type and method signatures.

Single threaded, reuse to save memory.

Create a new Signature, then call setSignature (String sig) to set the active signature. This will result in the passed signature being parsed and stored into local fields.

isMethod returns true if the signature was a method signature, if so call getReturnType, getParameterCount, and getParameter (int param) to access the different pieces.

If isMethod returns false it was a simple type declaration. If so call getType to access the type.

As it parses it will encounter object types, such as java/lang/String, and it needs to know how to format these. You can register a single NameFormatListener for such a purpose.


Nested Class Summary
static interface Signature.TypeFormatter
          A listener interface.
 
Constructor Summary
Signature(Signature.TypeFormatter formatter)
          Create a new Signature parse using the given (possibly null) type formatter.
 
Method Summary
 java.lang.String getParameter(int n)
          Get the nth parameter.
 int getParameterCount()
          How many parameters does the method take?
 java.lang.String getType()
          What is the field type or method return type?
 boolean hasMore()
          Return true if there is more signature to parse.
 boolean isMethod()
          Is it a method?
 void parseType()
          Parse a single type declaration.
 void setSignature(java.lang.String sig)
          Set the signature and parse into pieces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Signature

public Signature(Signature.TypeFormatter formatter)
Create a new Signature parse using the given (possibly null) type formatter.

Method Detail

setSignature

public void setSignature(java.lang.String sig)
Set the signature and parse into pieces.


parseType

public void parseType()
Parse a single type declaration.


hasMore

public boolean hasMore()
Return true if there is more signature to parse.


isMethod

public boolean isMethod()
Is it a method?


getType

public java.lang.String getType()
What is the field type or method return type?


getParameterCount

public int getParameterCount()
How many parameters does the method take?


getParameter

public java.lang.String getParameter(int n)
Get the nth parameter.



Copyright ? 2000-2003 Clarity Systems Group, LLC. All Rights Reserved.