java.lang.Object
com.ibm.jzos.fields.BinaryAsBigIntegerField
com.ibm.jzos.fields.BinaryAsBigDecimalField
- All Implemented Interfaces:
BigDecimalAccessor
,BigIntegerAccessor
,Field
A binary field with BigDecimal accessors. A "scale" determines the implied number
of digits in the fractional part of the field.
- Since:
- 2.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryAsBigDecimalField
(int offset, int length, int scale, boolean signed) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
equals
(BigDecimal a, BigDecimal b) Compare two BigDecimal instances, possibly null, for equality.getBigDecimal
(byte[] buffer) Answer a BigDecimal from the given byte array buffer, at the offset of this field.getBigDecimal
(byte[] buffer, int bufOffset) Answer a BigDecimal from the given byte array buffer, at the bufOffset + offset of this field.int
getScale()
void
putBigDecimal
(BigDecimal value, byte[] buffer) Put a BigDecimal into the given byte array buffer, at the offset of this field.void
putBigDecimal
(BigDecimal value, byte[] buffer, int bufOffset) Put a BigDecimal into the given byte array buffer, at the bufOffset + offset of this field.Methods inherited from class com.ibm.jzos.fields.BinaryAsBigIntegerField
equals, getBigInteger, getBigInteger, getByteLength, getLength, getOffset, isSigned, putBigInteger, putBigInteger, setOffset
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibm.jzos.fields.Field
getByteLength, getOffset, setOffset
-
Constructor Details
-
BinaryAsBigDecimalField
public BinaryAsBigDecimalField(int offset, int length, int scale, boolean signed) Construct an instance.- Parameters:
offset
- int the offset of this fieldlength
- int the size in bytes of this fieldscale
- the number of implied decimal digits in the fractional part of the fieldsigned
- boolean true if the value is signed, false if unsigned
-
-
Method Details
-
getBigDecimal
Answer a BigDecimal from the given byte array buffer, at the offset of this field.- Specified by:
getBigDecimal
in interfaceBigDecimalAccessor
- Parameters:
buffer
- the byte array- Returns:
- BigDecimal
-
getBigDecimal
Answer a BigDecimal from the given byte array buffer, at the bufOffset + offset of this field.- Specified by:
getBigDecimal
in interfaceBigDecimalAccessor
- Parameters:
buffer
- the byte arraybufOffset
- the additional offset into the byte array- Returns:
- BigDecimal
-
putBigDecimal
Put a BigDecimal into the given byte array buffer, at the offset of this field.- Specified by:
putBigDecimal
in interfaceBigDecimalAccessor
- Parameters:
value
- the BigDecimal valuebuffer
- the byte array- Throws:
IllegalArgumentException
- if the value is out of range
-
putBigDecimal
public void putBigDecimal(BigDecimal value, byte[] buffer, int bufOffset) throws IllegalArgumentException Put a BigDecimal into the given byte array buffer, at the bufOffset + offset of this field.- Specified by:
putBigDecimal
in interfaceBigDecimalAccessor
- Parameters:
value
- the BigDecimal valuebuffer
- the byte arraybufOffset
- the additional offset into the byte array- Throws:
IllegalArgumentException
- if the value is out of range
-
equals
Compare two BigDecimal instances, possibly null, for equality.- Parameters:
a
- BigDecimalb
- BigDecimal- Returns:
- boolean true if equal, false otherwise
-
getScale
public int getScale()- Overrides:
getScale
in classBinaryAsBigIntegerField
- Returns:
- int the scale <= 0
-