public final class Signature
extends java.lang.Object
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.
Modifier and Type | Class and Description |
---|---|
static interface |
Signature.TypeFormatter
A listener interface.
|
Constructor and Description |
---|
Signature(Signature.TypeFormatter formatter)
Create a new Signature parse using the given (possibly null)
type formatter.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public Signature(Signature.TypeFormatter formatter)
public void setSignature(java.lang.String sig)
public void parseType()
public boolean hasMore()
public boolean isMethod()
public java.lang.String getType()
public int getParameterCount()
public java.lang.String getParameter(int n)
Copyright ? 2000-2003 Clarity Systems Group, LLC. All Rights Reserved.