public class AstLiteral extends AbstractAstNode implements AstAttributeValue
AstNode.AbstractVisitor<C,R>, AstNode.Visitor<C,R>
Modifier and Type | Field and Description |
---|---|
LiteralKind |
kind
The kind of this literal.
|
String |
token
The (original) token of this literal.
|
Constructor and Description |
---|
AstLiteral(Region region,
String token,
LiteralKind kind)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
<C,R> R |
accept(C context,
AstNode.Visitor<C,R> visitor)
Accepts and calls back the visitor.
|
boolean |
equals(Object obj) |
LiteralKind |
getKind()
Returns the kind of this literal.
|
Region |
getRegion()
Returns the region of this node.
|
String |
getToken()
Returns the token of this literal.
|
int |
hashCode() |
static String |
quote(String string)
Converts the string as the token of DMDL string literal.
|
boolean |
toBooleanValue()
Returns the boolean value of this literal.
|
BigDecimal |
toDecimalValue()
Returns the decimal value of this literal.
|
BigInteger |
toIntegerValue()
Returns the integer value of this literal.
|
String |
toStringValue()
Returns the string value of this literal.
|
Object |
toValue()
Returns the value of this literal.
|
public final String token
public final LiteralKind kind
public AstLiteral(Region region, String token, LiteralKind kind)
region
- the region of this node on the enclosing script, or null
if unknowntoken
- the token of this literalkind
- the kind of this literalIllegalArgumentException
- if some parameters were null
public static String quote(String string)
string
- target stringIllegalArgumentException
- if some parameters were null
public String toStringValue()
IllegalStateException
- if this is not a string literalpublic BigInteger toIntegerValue()
IllegalStateException
- if this is not an integer literalpublic BigDecimal toDecimalValue()
IllegalStateException
- if this is not a decimal literalpublic boolean toBooleanValue()
IllegalStateException
- if this is not a boolean literalpublic Object toValue()
public Region getRegion()
AstNode
public String getToken()
public LiteralKind getKind()
public <C,R> R accept(C context, AstNode.Visitor<C,R> visitor)
AstNode
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.