Package org.codehaus.janino.util.signature

# Class SignatureParser

java.lang.Object
org.codehaus.janino.util.signature.SignatureParser

public class SignatureParser extends Object
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 Classes
Modifier and Type
Class
Description
`static class`
`SignatureParser.ArrayTypeSignature`
Representation of the "ArrayTypeSignature" clause.
`static class`
`SignatureParser.ClassSignature`
Representation of the "ClassSignature" clause.
`static class`
`SignatureParser.ClassTypeSignature`
Representation of the "ClassTypeSignature" clause, e.g.
`static interface`
`SignatureParser.FieldTypeSignature`
Representation of the "FieldTypeSignature" clause.
`static interface`
`SignatureParser.FieldTypeSignatureVisitor<T,EX extends Throwable>`
`static class`
`SignatureParser.FormalTypeParameter`
Representation of the "FormalTypeParameter" clause, e.g.
`static class`
`SignatureParser.MethodTypeSignature`
Representation of the "MethodTypeSignature" clause.
`static interface`
`SignatureParser.Options`
`static class`
`SignatureParser.PrimitiveTypeSignature`
Representation of the "PrimitiveTypeSignature" clause, i.e.
`static class`
`SignatureParser.SignatureException`
Signalizes am malformed signature.
`static class`
`SignatureParser.SimpleClassTypeSignature`
Representation of the "SimpleClassTypeSignature" clause, e.g.
`static interface`
`SignatureParser.ThrowsSignature`
Representation of the "ThrowsSignature" clause.
`static class`
`SignatureParser.TypeArgument`
Representation of the "TypeArgument" clause.
`static interface`
`SignatureParser.TypeSignature`
Representation of the "TypeSignature" clause.
`static class`
`SignatureParser.TypeVariableSignature`
Representation of the "TypeVariableSignature" clause, e.g.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final SignatureParser.PrimitiveTypeSignature`
`BOOLEAN`
The primitive '`boolean`' type.
`static final SignatureParser.PrimitiveTypeSignature`
`BYTE`
The primitive '`byte`' type.
`static final SignatureParser.PrimitiveTypeSignature`
`CHAR`
The primitive '`char`' type.
`static final SignatureParser.Options`
`DEFAULT_OPTIONS`
A trivial implementation of `SignatureParser.Options`.
`static final SignatureParser.PrimitiveTypeSignature`
`DOUBLE`
The primitive '`double`' type.
`static final SignatureParser.PrimitiveTypeSignature`
`FLOAT`
The primitive '`float`' type.
`static final SignatureParser.PrimitiveTypeSignature`
`INT`
The primitive '`int`' type.
`static final SignatureParser.PrimitiveTypeSignature`
`LONG`
The primitive '`long`' type.
`final SignatureParser.ClassTypeSignature`
`object`
The class type signature of the `Object` class.
`static final SignatureParser.PrimitiveTypeSignature`
`SHORT`
The primitive '`short`' type.
`static final SignatureParser.TypeSignature`
`VOID`
Representation of the 'void' type.

## Constructor Summary

Constructors
Constructor
Description
`SignatureParser()`
`SignatureParser(SignatureParser.Options options)`

## Method Summary

Modifier and Type
Method
Description
`SignatureParser.TypeSignature`
`decodeClassNameOrFieldDescriptor(String s)`
Decodes a "class-name-or-field-descriptor" as defined in JLS8 4.4.1 ("name_index").
`SignatureParser.ClassSignature`
`decodeClassSignature(String s)`
Decodes a 'class signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.
`SignatureParser.TypeSignature`
`decodeFieldDescriptor(String s)`
Decodes a 'field descriptor' as defined in JLS7 4.3.2.
`SignatureParser.FieldTypeSignature`
`decodeFieldTypeSignature(String s)`
Decodes a 'field type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.
`SignatureParser.MethodTypeSignature`
`decodeMethodDescriptor(String s)`
Decodes a 'method descriptor' as defined in JVMS[78] 4.3.3.
`SignatureParser.MethodTypeSignature`
`decodeMethodTypeSignature(String s)`
Decodes a 'method type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.
`SignatureParser.TypeSignature`
`decodeReturnType(String s)`
Decodes a 'return type' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.
`SignatureParser.TypeSignature`
`decodeTypeSignature(String s)`
Decodes a 'type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_OPTIONS

public static final SignatureParser.Options DEFAULT_OPTIONS
A trivial implementation of `SignatureParser.Options`.

### object

public final SignatureParser.ClassTypeSignature object
The class type signature of the `Object` class.

### BYTE

public static final SignatureParser.PrimitiveTypeSignature BYTE
The primitive '`byte`' type.

### CHAR

public static final SignatureParser.PrimitiveTypeSignature CHAR
The primitive '`char`' type.

### DOUBLE

public static final SignatureParser.PrimitiveTypeSignature DOUBLE
The primitive '`double`' type.

### FLOAT

public static final SignatureParser.PrimitiveTypeSignature FLOAT
The primitive '`float`' type.

### INT

public static final SignatureParser.PrimitiveTypeSignature INT
The primitive '`int`' type.

### LONG

public static final SignatureParser.PrimitiveTypeSignature LONG
The primitive '`long`' type.

### SHORT

public static final SignatureParser.PrimitiveTypeSignature SHORT
The primitive '`short`' type.

### BOOLEAN

public static final SignatureParser.PrimitiveTypeSignature BOOLEAN
The primitive '`boolean`' type.

### VOID

public static final SignatureParser.TypeSignature VOID
Representation of the 'void' type.

## Constructor Details

### SignatureParser

public SignatureParser()

### SignatureParser

public SignatureParser(SignatureParser.Options options)

## 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.

Throws:
  `SignatureParser.SignatureException`

### 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.

Throws:
  `SignatureParser.SignatureException`

### 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.

Throws:
  `SignatureParser.SignatureException`

### 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.

Throws:
  `SignatureParser.SignatureException`

### 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.

Throws:
  `SignatureParser.SignatureException`

### 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").

Throws:
  `SignatureParser.SignatureException`

### 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.

Throws:
  `SignatureParser.SignatureException`