public final class DecimalOption extends ValueOption<DecimalOption>
null
.nullValue
Constructor and Description |
---|
DecimalOption()
Creates a new instance which represents
null value. |
DecimalOption(BigDecimal valueOrNull)
Creates a new instance which represents the specified value.
|
Modifier and Type | Method and Description |
---|---|
void |
add(BigDecimal delta)
Adds a value into this object.
|
void |
add(DecimalOption other)
Adds a value into this object.
|
static int |
compareBytes(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
Compares between the two objects in serialized form.
|
int |
compareInBytes(byte[] b1,
int o1,
byte[] b2,
int o2)
Compares two objects in bytes.
|
int |
compareTo(WritableRawComparable o) |
void |
copyFrom(DecimalOption optionOrNull)
Deprecated.
|
boolean |
equals(Object obj) |
BigDecimal |
get()
Returns the value which this object represents.
|
static int |
getBytesLength(byte[] bytes,
int offset,
int length)
Returns the actual number of bytes from the serialized byte array.
|
int |
getSizeInBytes(byte[] buf,
int offset)
Computes and returns size in bytes.
|
boolean |
has(BigDecimal other)
Returns whether both this object and the specified value represents an equivalent value or not.
|
int |
hashCode() |
DecimalOption |
modify(BigDecimal newValue)
Deprecated.
Application developer should not use this method directly
|
BigDecimal |
or(BigDecimal alternate)
Returns the value which this object represents.
|
void |
readFields(DataInput in) |
int |
restore(byte[] bytes,
int offset,
int limit)
Restores the contents from the slice of the byte array.
|
String |
toString() |
void |
write(DataOutput out) |
public DecimalOption()
null
value.public DecimalOption(BigDecimal valueOrNull)
valueOrNull
- the initial valuepublic BigDecimal get()
null
NullPointerException
- if this object represents null
public BigDecimal or(BigDecimal alternate)
alternate
- the alternative value for null
null
public void add(BigDecimal delta)
delta
- the value to be addNullPointerException
- if this object represents null
or the value is null
public void add(DecimalOption other)
other
- the value to be add, or null
to do nothingNullPointerException
- if this object represents null
@Deprecated public DecimalOption modify(BigDecimal newValue)
newValue
- the value (nullable)@Deprecated public void copyFrom(DecimalOption optionOrNull)
ValueOption
copyFrom
in class ValueOption<DecimalOption>
optionOrNull
- the source object, or null
to make this value represent null
public boolean has(BigDecimal other)
other
- the target value (nullable)true
if this object has the specified value, otherwise false
public int compareTo(WritableRawComparable o)
public void write(DataOutput out) throws IOException
IOException
public void readFields(DataInput in) throws IOException
IOException
public int restore(byte[] bytes, int offset, int limit) throws IOException
Restorable
bytes
- the byte arrayoffset
- the beginning index in the byte array (inclusive)limit
- the ending index in the byte array (exclusive)IOException
- if failed to restore the contentspublic int getSizeInBytes(byte[] buf, int offset) throws IOException
WritableRawComparable
buf
- bytes arrayoffset
- bytes offsetIOException
- if failed to compute sizepublic int compareInBytes(byte[] b1, int o1, byte[] b2, int o2) throws IOException
WritableRawComparable
b1
- bytes representation of the first objecto1
- offset of the first objectb2
- bytes representation of the second objecto2
- offset of the second objectIOException
- if failed to comparisonpublic static int getBytesLength(byte[] bytes, int offset, int length)
bytes
- the target byte arrayoffset
- the beginning index in the byte array (inclusive)length
- the limit length of the byte arraypublic static int compareBytes(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
b1
- the first byte array to be compareds1
- the beginning index in b1
l1
- the limit byte size in b1
b2
- the second byte array to be compareds2
- the beginning index in b2
l2
- the limit byte size in b2
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.