Top Description Fields Constructors Methods
org.codehaus.janino

public final Class Token

extends Object
Class Inheritance
Imports
org.codehaus.commons.compiler.Location, org.codehaus.commons.nullanalysis.Nullable

Immutable representation of a Java token.

Field Summary

Modifier and TypeField and Description
private final int
private final String
private final int
private Location
public final TokenType
type

The type of this token.

public final String
value

The text of the token exactly as it appears in the source code.

Constructor Summary

AccessConstructor and Description
public
Token(String fileName, int lineNumber, int columnNumber, TokenType type, String value)

public
Token(Location location, TokenType type, String value)

Method Summary

Modifier and TypeMethod and Description
public Location

Returns:

The location of the first character of this token
getLocation
()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

columnNumberback to summary
private final int columnNumber
fileNameback to summary
private final String fileName
Annotations
@Nullable
lineNumberback to summary
private final int lineNumber
locationback to summary
private Location location
Annotations
@Nullable
typeback to summary
public final TokenType type

The type of this token.

Strictly speaking, this field is redundant, because the token type can always be deduced from the token value, e.g. iff the value begins with "'", then the type is TokenType#CHARACTER_LITERAL.

valueback to summary
public final String value

The text of the token exactly as it appears in the source code.

Iff this token represents a keyword, true, false, null or an operator, then this string is interned, so that it can be reference-compared with other interned strings.

Constructor Detail

Tokenback to summary
public Token(String fileName, int lineNumber, int columnNumber, TokenType type, String value)
Tokenback to summary
public Token(Location location, TokenType type, String value)

Method Detail

getLocationback to summary
public Location getLocation()
Returns:Location

The location of the first character of this token

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override