@Immutable public final class IntegerData extends NumberData
Important: This class may only be used in implementing plugins (e.g. functions, directives).
| Modifier and Type | Field and Description |
|---|---|
static IntegerData |
MINUS_ONE
Static instance of IntegerData with value -1.
|
static IntegerData |
ONE
Static instance of IntegerData with value 1.
|
static IntegerData |
ZERO
Static instance of IntegerData with value 0.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
coerceToBoolean()
Coerces this value into a boolean.
|
String |
coerceToString()
Coerces this value into a string.
|
boolean |
equals(Object other)
Compares this value against another for equality in the sense of the '==' operator of Soy.
|
static IntegerData |
forValue(long value)
Gets a IntegerData instance for the given value.
|
long |
getValue()
Returns the integer value.
|
int |
integerValue()
Precondition: Only call this method if you know that this SoyValue object is a 32-bit integer.
|
long |
longValue()
Precondition: Only call this method if you know that this SoyValue object is an integer or
long.
|
double |
toFloat()
Gets the float value of this number data object.
|
String |
toString() |
hashCode, numberValuerendercreateFromExistingDatabooleanValue, floatValue, render, renderAndResolve, resolve, status, stringValuepublic static final IntegerData ZERO
public static final IntegerData ONE
public static final IntegerData MINUS_ONE
public static IntegerData forValue(long value)
value - The desired value.public long getValue()
public int integerValue()
SoyValueintegerValue in interface SoyValueintegerValue in class SoyAbstractValuepublic long longValue()
SoyValuelongValue in interface SoyValuelongValue in class SoyAbstractValuepublic boolean coerceToBoolean()
0 is falsy.
public String coerceToString()
SoyValuepublic double toFloat()
NumberDatatoFloat in class NumberDatapublic boolean equals(Object other)
SoyValueequals in interface SoyValueequals in class NumberDataother - The other value to compare against.