Package org.apache.sling.scripting.sightly.compiler.expression.nodes

## Class NumericConstant

- java.lang.Object
- - org.apache.sling.scripting.sightly.compiler.expression.nodes.NumericConstant

All Implemented Interfaces:
  `ExpressionNode`, `Atom`

    public final class NumericConstant
    extends Object
    implements Atom

Defines a numeric constant expression (e.g. "42.1").

### Field Summary

Fields
`static NumericConstant` `ONE`
`static NumericConstant` `TWO`
`static NumericConstant` `ZERO`

### Constructor Summary

Constructors
`NumericConstant​(Number value)` Creates a numeric constant based on a `Number` representation.
`NumericConstant​(String text)` Creates a numeric constant.

### Method Summary

All Methods Instance Methods Concrete Methods
`<T> T` `accept​(NodeVisitor<T> visitor)` Accept a visitor to process this node.
`String` `getText()` Get the text content for this nodes
`Number` `getValue()` Returns the number representation of this constant.
`String` `toString()`

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

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

### 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​(String text)

Creates a numeric constant.

Parameters:
  `text` - the text representation
Throws:
  `NumberFormatException` - if the text is not in a numeric format

#### NumericConstant

    public NumericConstant​(Number value)

Creates a numeric constant based on a `Number` representation.

Parameters:
  `value` - the number representation

### Method Detail

#### getValue

    public Number getValue()

Returns the number representation of this constant.

Returns:
  the number representation of this constant

#### getText

    public String getText()

Description copied from interface: `Atom`
Get the text content for this nodes

Specified by:
  `getText` in interface `Atom`
Returns:
  the text content

#### accept

    public <T> T accept​(NodeVisitor<T> visitor)

Description copied from interface: `ExpressionNode`
Accept a visitor to process this node.

Specified by:
  `accept` in interface `ExpressionNode`
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 String toString()

Overrides:
  `toString` in class `Object`