Class NumericConstant
- java.lang.Object
 - 
- org.apache.sling.scripting.sightly.compiler.expression.nodes.NumericConstant
 
 
- 
- All Implemented Interfaces:
 ExpressionNode,Atom
public final class NumericConstant extends java.lang.Object implements Atom
Defines a numeric constant expression (e.g. "42.1"). 
- 
- 
Field Summary
Fields Modifier and Type Field Description static NumericConstantONEstatic NumericConstantTWOstatic NumericConstantZERO 
- 
Constructor Summary
Constructors Constructor Description NumericConstant(java.lang.Number value)Creates a numeric constant based on aNumberrepresentation.NumericConstant(java.lang.String text)Creates a numeric constant. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(NodeVisitor<T> visitor)Accept a visitor to process this node.java.lang.StringgetText()Get the text content for this nodesjava.lang.NumbergetValue()Returns the number representation of this constant.java.lang.StringtoString() 
 - 
 
- 
- 
Field Detail
- 
ZERO
public static final NumericConstant ZERO
 
- 
ONE
public static final NumericConstant ONE
 
- 
TWO
public static final NumericConstant TWO
 
 - 
 
- 
Constructor Detail
- 
NumericConstant
public NumericConstant(java.lang.String text)
Creates a numeric constant.- Parameters:
 text- the text representation- Throws:
 java.lang.NumberFormatException- if the text is not in a numeric format
 
- 
NumericConstant
public NumericConstant(java.lang.Number value)
Creates a numeric constant based on aNumberrepresentation.- Parameters:
 value- the number representation
 
 - 
 
- 
Method Detail
- 
getValue
public java.lang.Number getValue()
Returns the number representation of this constant.- Returns:
 - the number representation of this constant
 
 
- 
getText
public java.lang.String getText()
Description copied from interface:AtomGet the text content for this nodes 
- 
accept
public <T> T accept(NodeVisitor<T> visitor)
Description copied from interface:ExpressionNodeAccept a visitor to process this node.- Specified by:
 acceptin interfaceExpressionNode- Type Parameters:
 T- the type of the visitor- Parameters:
 visitor- The visitor- Returns:
 - the node after it has been evaluated by the visitor
 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -