public final class TraceSignatureVisitor extends SignatureVisitor
SignatureVisitor
that builds the Java generic type declaration corresponding to the
signature it visits.Modifier and Type | Field and Description |
---|---|
private int |
argumentStack
The stack used to keep track of class types that have arguments.
|
private int |
arrayStack
The stack used to keep track of array class types.
|
private static java.util.Map<java.lang.Character,java.lang.String> |
BASE_TYPES |
private static java.lang.String |
COMMA_SEPARATOR |
private java.lang.StringBuilder |
declaration
The Java generic type declaration corresponding to the visited signature.
|
private java.lang.StringBuilder |
exceptions
The Java generic exception types declaration corresponding to the visited signature.
|
private static java.lang.String |
EXTENDS_SEPARATOR |
private boolean |
formalTypeParameterVisited
Whether
visitFormalTypeParameter(java.lang.String) has been called. |
private static java.lang.String |
IMPLEMENTS_SEPARATOR |
private boolean |
interfaceBoundVisited
Whether
visitInterfaceBound() has been called. |
private boolean |
interfaceVisited
Whether
visitInterface() has been called. |
private boolean |
isInterface
Whether the visited signature is a class signature of a Java interface.
|
private boolean |
parameterTypeVisited
Whether
visitParameterType() has been called. |
private java.lang.StringBuilder |
returnType
The Java generic method return type declaration corresponding to the visited signature.
|
private java.lang.String |
separator
The separator to append before the next visited class or inner class type.
|
api, EXTENDS, INSTANCEOF, SUPER
Modifier | Constructor and Description |
---|---|
|
TraceSignatureVisitor(int accessFlags)
Constructs a new
TraceSignatureVisitor . |
private |
TraceSignatureVisitor(java.lang.StringBuilder stringBuilder) |
Modifier and Type | Method and Description |
---|---|
private void |
endFormals() |
private void |
endType() |
java.lang.String |
getDeclaration()
Returns the Java generic type declaration corresponding to the visited signature.
|
java.lang.String |
getExceptions()
Returns the Java generic exception types declaration corresponding to the visited signature.
|
java.lang.String |
getReturnType()
Returns the Java generic method return type declaration corresponding to the visited signature.
|
private void |
startType() |
SignatureVisitor |
visitArrayType()
Visits a signature corresponding to an array type.
|
void |
visitBaseType(char descriptor)
Visits a signature corresponding to a primitive type.
|
SignatureVisitor |
visitClassBound()
Visits the class bound of the last visited formal type parameter.
|
void |
visitClassType(java.lang.String name)
Starts the visit of a signature corresponding to a class or interface type.
|
void |
visitEnd()
Ends the visit of a signature corresponding to a class or interface type.
|
SignatureVisitor |
visitExceptionType()
Visits the type of a method exception.
|
void |
visitFormalTypeParameter(java.lang.String name)
Visits a formal type parameter.
|
void |
visitInnerClassType(java.lang.String name)
Visits an inner class.
|
SignatureVisitor |
visitInterface()
Visits the type of an interface implemented by the class.
|
SignatureVisitor |
visitInterfaceBound()
Visits an interface bound of the last visited formal type parameter.
|
SignatureVisitor |
visitParameterType()
Visits the type of a method parameter.
|
SignatureVisitor |
visitReturnType()
Visits the return type of the method.
|
SignatureVisitor |
visitSuperclass()
Visits the type of the super class.
|
void |
visitTypeArgument()
Visits an unbounded type argument of the last visited class or inner class type.
|
SignatureVisitor |
visitTypeArgument(char tag)
Visits a type argument of the last visited class or inner class type.
|
void |
visitTypeVariable(java.lang.String name)
Visits a signature corresponding to a type variable.
|
private static final java.lang.String COMMA_SEPARATOR
private static final java.lang.String EXTENDS_SEPARATOR
private static final java.lang.String IMPLEMENTS_SEPARATOR
private static final java.util.Map<java.lang.Character,java.lang.String> BASE_TYPES
private final boolean isInterface
private final java.lang.StringBuilder declaration
private java.lang.StringBuilder returnType
private java.lang.StringBuilder exceptions
private boolean formalTypeParameterVisited
visitFormalTypeParameter(java.lang.String)
has been called.private boolean interfaceBoundVisited
visitInterfaceBound()
has been called.private boolean parameterTypeVisited
visitParameterType()
has been called.private boolean interfaceVisited
visitInterface()
has been called.private int argumentStack
private int arrayStack
private java.lang.String separator
public TraceSignatureVisitor(int accessFlags)
TraceSignatureVisitor
.accessFlags
- for class type signatures, the access flags of the class.private TraceSignatureVisitor(java.lang.StringBuilder stringBuilder)
public void visitFormalTypeParameter(java.lang.String name)
SignatureVisitor
visitFormalTypeParameter
in class SignatureVisitor
name
- the name of the formal parameter.public SignatureVisitor visitClassBound()
SignatureVisitor
visitClassBound
in class SignatureVisitor
public SignatureVisitor visitInterfaceBound()
SignatureVisitor
visitInterfaceBound
in class SignatureVisitor
public SignatureVisitor visitSuperclass()
SignatureVisitor
visitSuperclass
in class SignatureVisitor
public SignatureVisitor visitInterface()
SignatureVisitor
visitInterface
in class SignatureVisitor
public SignatureVisitor visitParameterType()
SignatureVisitor
visitParameterType
in class SignatureVisitor
public SignatureVisitor visitReturnType()
SignatureVisitor
visitReturnType
in class SignatureVisitor
public SignatureVisitor visitExceptionType()
SignatureVisitor
visitExceptionType
in class SignatureVisitor
public void visitBaseType(char descriptor)
SignatureVisitor
visitBaseType
in class SignatureVisitor
descriptor
- the descriptor of the primitive type, or 'V' for void
.public void visitTypeVariable(java.lang.String name)
SignatureVisitor
visitTypeVariable
in class SignatureVisitor
name
- the name of the type variable.public SignatureVisitor visitArrayType()
SignatureVisitor
visitArrayType
in class SignatureVisitor
public void visitClassType(java.lang.String name)
SignatureVisitor
visitClassType
in class SignatureVisitor
name
- the internal name of the class or interface.public void visitInnerClassType(java.lang.String name)
SignatureVisitor
visitInnerClassType
in class SignatureVisitor
name
- the local name of the inner class in its enclosing class.public void visitTypeArgument()
SignatureVisitor
visitTypeArgument
in class SignatureVisitor
public SignatureVisitor visitTypeArgument(char tag)
SignatureVisitor
visitTypeArgument
in class SignatureVisitor
tag
- '+', '-' or '='.public void visitEnd()
SignatureVisitor
visitEnd
in class SignatureVisitor
public java.lang.String getDeclaration()
public java.lang.String getReturnType()
public java.lang.String getExceptions()
private void endFormals()
private void startType()
private void endType()