Class SignatureParser
java.lang.Object
org.codehaus.janino.util.signature.SignatureParser
Helper class for parsing signatures and descriptors. See
Java 5 class file format,
section 4.4.4, "Signatures".
The various structures that the parser returns (e.g. SignatureParser.ClassTypeSignature
) all have Object.toString()
methods that convert them into nice, human-readable strings. This conversion can be customized
using SignatureParser(Options)
and passing a custom SignatureParser.Options
object.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Representation of the "ArrayTypeSignature" clause.static class
Representation of the "ClassSignature" clause.static class
Representation of the "ClassTypeSignature" clause, e.g.static interface
Representation of the "FieldTypeSignature" clause.static interface
static class
Representation of the "FormalTypeParameter" clause, e.g.static class
Representation of the "MethodTypeSignature" clause.static interface
static class
Representation of the "PrimitiveTypeSignature" clause, i.e.static class
Signalizes am malformed signature.static class
Representation of the "SimpleClassTypeSignature" clause, e.g.static interface
Representation of the "ThrowsSignature" clause.static class
Representation of the "TypeArgument" clause.static interface
Representation of the "TypeSignature" clause.static class
Representation of the "TypeVariableSignature" clause, e.g. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SignatureParser.PrimitiveTypeSignature
The primitive 'boolean
' type.static final SignatureParser.PrimitiveTypeSignature
The primitive 'byte
' type.static final SignatureParser.PrimitiveTypeSignature
The primitive 'char
' type.static final SignatureParser.Options
A trivial implementation ofSignatureParser.Options
.static final SignatureParser.PrimitiveTypeSignature
The primitive 'double
' type.static final SignatureParser.PrimitiveTypeSignature
The primitive 'float
' type.static final SignatureParser.PrimitiveTypeSignature
The primitive 'int
' type.static final SignatureParser.PrimitiveTypeSignature
The primitive 'long
' type.The class type signature of theObject
class.static final SignatureParser.PrimitiveTypeSignature
The primitive 'short
' type.static final SignatureParser.TypeSignature
Representation of the 'void' type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecodes a "class-name-or-field-descriptor" as defined in JLS8 4.4.1 ("name_index").Decodes a 'class signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'field descriptor' as defined in JLS7 4.3.2.Decodes a 'field type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'method descriptor' as defined in JVMS[78] 4.3.3.Decodes a 'method type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'return type' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.
-
Field Details
-
DEFAULT_OPTIONS
A trivial implementation ofSignatureParser.Options
. -
object
The class type signature of theObject
class. -
BYTE
The primitive 'byte
' type. -
CHAR
The primitive 'char
' type. -
DOUBLE
The primitive 'double
' type. -
FLOAT
The primitive 'float
' type. -
INT
The primitive 'int
' type. -
LONG
The primitive 'long
' type. -
SHORT
The primitive 'short
' type. -
BOOLEAN
The primitive 'boolean
' type. -
VOID
Representation of the 'void' type.
-
-
Constructor Details
-
SignatureParser
public SignatureParser() -
SignatureParser
-
-
Method Details
-
decodeClassSignature
public SignatureParser.ClassSignature decodeClassSignature(String s) throws SignatureParser.SignatureException Decodes a 'class signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeMethodTypeSignature
public SignatureParser.MethodTypeSignature decodeMethodTypeSignature(String s) throws SignatureParser.SignatureException Decodes a 'method type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeTypeSignature
public SignatureParser.TypeSignature decodeTypeSignature(String s) throws SignatureParser.SignatureException Decodes a 'type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeFieldTypeSignature
public SignatureParser.FieldTypeSignature decodeFieldTypeSignature(String s) throws SignatureParser.SignatureException Decodes a 'field type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeMethodDescriptor
public SignatureParser.MethodTypeSignature decodeMethodDescriptor(String s) throws SignatureParser.SignatureException Decodes a 'method descriptor' as defined in JVMS[78] 4.3.3.- Returns:
- E.g.
"(Object[]) => java.util.stream.Stream"
or"join()"
(void method) - Throws:
SignatureParser.SignatureException
-
decodeFieldDescriptor
public SignatureParser.TypeSignature decodeFieldDescriptor(String s) throws SignatureParser.SignatureException Decodes a 'field descriptor' as defined in JLS7 4.3.2. -
decodeClassNameOrFieldDescriptor
public SignatureParser.TypeSignature decodeClassNameOrFieldDescriptor(String s) throws SignatureParser.SignatureException Decodes a "class-name-or-field-descriptor" as defined in JLS8 4.4.1 ("name_index"). -
decodeReturnType
public SignatureParser.TypeSignature decodeReturnType(String s) throws SignatureParser.SignatureException Decodes a 'return type' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.
-