public final class MoneyRegister extends Object implements ScalarRegister, MoneySettable
MoneyValued object.MAX_INFINITY, MIN_INFINITY| Constructor and Description |
|---|
MoneyRegister()
Creates a new null-valued register.
|
| Modifier and Type | Method and Description |
|---|---|
BigDecimal |
asBigDecimal()
Gets the contained numeric value.
|
long |
asCents()
Gets the contained cents value as a long
|
double |
asDouble()
Gets the contained double value.
|
float |
asFloat()
Gets the contained float value.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
void |
set(float value)
Sets the container to the given money value.
|
void |
set(int value)
Sets the container to the given integer value.
|
void |
set(long value)
Sets the container to the given long value.
|
void |
set(TokenValued value)
Sets the contained value to the given token value.
|
void |
setNull()
Sets the contained value to be null valued.
|
void |
setZero()
Sets the contained value to be zero valued.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetType, isZeroisNullpublic void setNull()
TokenSettablesetNull in interface TokenSettablepublic void setZero()
TokenSettablesetZero in interface TokenSettablepublic void set(int value)
IntSettableset in interface IntSettablevalue - integer value to which to set the containerpublic void set(long value)
LongSettableset in interface LongSettablevalue - long value to which to set the containerpublic void set(float value)
MoneySettableset in interface MoneySettablevalue - money value to which to set the containerpublic void set(TokenValued value)
TokenSettableset in interface TokenSettablevalue - the value to which to set the containerpublic final ScalarTokenType getType()
TokenValuedgetType in interface ScalarValuedgetType in interface TokenValuedgetType in interface ScalarTypedgetType in interface TokenTypedpublic final BigDecimal asBigDecimal()
NumericValuedasBigDecimal in interface NumericValuedjava.math.BigDecimal.
If null valued, as indicated by TokenValued.isNull(), null
is returned.public final double asDouble()
DoubleValuedasDouble in interface DoubleValueddouble. If null valued,
as indicated by TokenValued.isNull(), Double.NaN
is returned.public final float asFloat()
FloatValuedasFloat in interface FloatValuedfloat. If null valued,
as indicated by TokenValued.isNull(), Float.NaN
is returned.public final long asCents()
MoneyValuedasCents in interface MoneyValuedlong. If null valued,
as indicated by TokenValued.isNull(), 0
is returned.public final boolean isZero()
ScalarValuedisZero in interface ScalarValuedtrue if the value is the zero value,
false otherwise.public final boolean isNull()
TokenValuedisNull in interface TokenValuedtrue if the token is null valued,
false otherwiseCopyright © 2021 Actian Corporation. All rights reserved.