public abstract class DatatypeFactory
extends java.lang.Object
Field
objects. A running offset to the next field is maintained, along with a
stack which can be used to push and pop the current Field offset.
A DatatypeFactory is typically used to statically initialize static
Field variables in a Java class which maps a record described by a byte array.
For an example, see Format1DSCB.
Instances of this class or its subclasses will automatically construct
instances of com.ibm.jzos.fields.daa classes if the
com.ibm.jzos.fields.daa package is available at runtime.
See the useDaa() method for more information.
For an example, see Format1DSCB.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
USE_DAA_DEFAULT
By default, Data Access Accelerator (DAA) will be used if the com.ibm.dataaccess (DAA) classes are available.
|
static java.lang.String |
USE_DAA_PROPERTY |
| Constructor and Description |
|---|
DatatypeFactory() |
| Modifier and Type | Method and Description |
|---|---|
BinaryAsBigDecimalField |
getBinaryAsBigDecimalField(int length,
int scale,
boolean signed)
Construct and return a BinaryAsBigDecimalField, advancing the current offset by its byte length.
|
BinaryAsBigIntegerField |
getBinaryAsBigIntegerField(int length,
boolean signed)
Construct and return a BinaryAsBigIntegerField, advancing the current offset by its byte length.
|
BinaryAsBigIntegerField |
getBinaryAsBigIntegerField(int length,
int scale,
boolean signed)
Construct and return a BinaryAsBigIntegerField, advancing the current offset by its byte length.
|
BinaryAsIntField |
getBinaryAsIntField(int length,
boolean signed)
Construct and return a BinaryAsIntField,
advancing the current offset by its byte length.
|
BinaryAsLongField |
getBinaryAsLongField(int length,
boolean signed)
Construct and return a BinaryAsLongField,
advancing the current offset by its byte length.
|
Field |
getBinaryField(int length,
boolean signed)
Construct and return either a BinaryAsIntField, BinaryAsLongField,
or BinaryAsBigIntegerField, depending on the length.
|
ByteArrayField |
getByteArrayField(int length)
Construct and return a ByteArrayField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigDecimalField |
getExternalDecimalAsBigDecimalField(int precision,
int scale,
boolean signed)
Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigDecimalField |
getExternalDecimalAsBigDecimalField(int precision,
int scale,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigIntegerField |
getExternalDecimalAsBigIntegerField(int precision,
boolean signed)
Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigIntegerField |
getExternalDecimalAsBigIntegerField(int precision,
int scale,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.
|
ExternalDecimalAsIntField |
getExternalDecimalAsIntField(int precision,
boolean signed)
Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.
|
ExternalDecimalAsIntField |
getExternalDecimalAsIntField(int precision,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.
|
ExternalDecimalAsLongField |
getExternalDecimalAsLongField(int precision,
boolean signed)
Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.
|
ExternalDecimalAsLongField |
getExternalDecimalAsLongField(int precision,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.
|
Field |
getExternalDecimalField(int precision,
int scale,
boolean signed,
boolean signTailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAs<*>Field, advancing the current offset by its byte length.
|
IbmDoubleField |
getIbmDoubleField()
Construct and return an IbmDoubleField (COMP-2 in COBOL)
Advance the current offset by its byte length.
|
IbmFloatField |
getIbmFloatField()
Construct and return an IbmFloatField (COMP-1 in COBOL).
|
int |
getMaximumOffset()
Answer the maximum value of the offset
|
int |
getOffset()
Answer the current (next) Field offset
|
PackedDecimalAsBigDecimalField |
getPackedDecimalAsBigDecimalField(int precision,
int scale,
boolean signed)
Construct and return a PackedDecimalAsBigDecimalField, advancing the current offset by its byte length.
|
PackedDecimalAsBigIntegerField |
getPackedDecimalAsBigIntegerField(int precision,
int scale,
boolean signed)
Construct and return a PackedDecimalAsBigIntegerField, advancing the current offset by its byte length.
|
PackedDecimalAsIntField |
getPackedDecimalAsIntField(int precision,
boolean signed)
Construct and return a PackedDecimalAsIntField, advancing the current offset by its byte length.
|
PackedDecimalAsLongField |
getPackedDecimalAsLongField(int precision,
boolean signed)
Construct and return a PackedDecimalAsLongField, advancing the current offset by its byte length.
|
abstract Field |
getPackedDecimalField(int precision,
int scale,
boolean signed)
Construct and return a PackedDecimalAs<*>Field, depending
on the length and scale requested.
|
java.lang.String |
getStringEncoding()
Gets the current String encoding used for construction of StringFields.
|
StringField |
getStringField(int length)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim,
boolean padLeft)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim,
boolean padLeft,
boolean allowTruncation)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim,
boolean padLeft,
boolean allowTruncation,
java.lang.String encoding)
Construct and return a StringField, advancing the current offset by its byte length.
|
boolean |
getStringTrimDefault()
Answer the default setting for StringField trimming if
not explicitly given.
|
void |
incrementOffset(int amount)
Increments the current Field offset
|
void |
popOffset()
Pop the Field offset from the top of an internal stack.
|
void |
pushOffset()
Push the current Field offset onto an internal stack.
|
void |
setOffset(int offset) |
void |
setStringEncoding(java.lang.String stringEncoding) |
void |
setStringTrimDefault(boolean value) |
void |
setUseDaa(boolean useDaa)
Configure this DatatypeFactory whether to use Data Access Accelerator classes.
|
boolean |
useDaa()
Returns whether using Data Access Accelerator (DAA).
|
public static final java.lang.String USE_DAA_PROPERTY
public static final boolean USE_DAA_DEFAULT
public int getOffset()
public int getMaximumOffset()
public void setOffset(int offset)
getOffset()public void pushOffset()
popOffset()public void popOffset()
pushOffset()public void incrementOffset(int amount)
amount - intpublic java.lang.String getStringEncoding()
StringField.getEncoding()public boolean getStringTrimDefault()
public void setStringTrimDefault(boolean value)
getStringTrimDefault()public void setStringEncoding(java.lang.String stringEncoding)
getStringEncoding()public boolean useDaa()
By default, factory methods in this class (and subclasses) will return subtype implementation
instances from the com.ibm.jzos.fields.daa package, which
exploit the com.ibm.dataaccess (DAA) classes if available.
DAA can be disabled by setting the system property com.ibm.jzos.fields.use-daa explicitly to false.
If the com.ibm.dataaccess (DAA) classes are not available, then DAA exploitation will be disabled.
public void setUseDaa(boolean useDaa)
useDaa - true if DAA classes are to be used. An IllegalStateException will be thrown if DAA classes
are not available. false if DAA classes are not to be exploited.java.lang.IllegalStateException - if DAA classes are not available.useDaa()public BinaryAsLongField getBinaryAsLongField(int length, boolean signed)
length - int the length of the field in bytessigned - boolean true if the field is signed, false if unsigned.BinaryAsLongFieldpublic BinaryAsIntField getBinaryAsIntField(int length, boolean signed)
length - int the length of the field in bytessigned - boolean true if the field is signed, false if unsigned.BinaryAsIntFieldpublic BinaryAsBigIntegerField getBinaryAsBigIntegerField(int length, int scale, boolean signed)
length - the number of bytes in the fieldscale - a negative integer specifying the power of the numbersigned - true if the value is signedpublic BinaryAsBigIntegerField getBinaryAsBigIntegerField(int length, boolean signed)
length - the number of bytes in the fieldsigned - true if the value is signedpublic BinaryAsBigDecimalField getBinaryAsBigDecimalField(int length, int scale, boolean signed)
length - the size in bytes of the fieldscale - the number of implied decimal digits to the right of the decimal pointsigned - true if the value is signedpublic Field getBinaryField(int length, boolean signed)
length - int the length of the field in bytessigned - boolean true if the field is signed, false if unsigned.BinaryAsIntField,
BinaryAsLongFieldpublic ExternalDecimalAsBigDecimalField getExternalDecimalAsBigDecimalField(int precision, int scale, boolean signed)
precision - the number of decimal digits of precisionscale - the number of implied decimal digits in the
fractional part of the fieldsigned - boolean true if the value is signedExternalDecimalAsBigDecimalField.ExternalDecimalAsBigDecimalField(int, int, int, boolean, boolean, boolean, boolean)public ExternalDecimalAsBigDecimalField getExternalDecimalAsBigDecimalField(int precision, int scale, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision - the number of decimal digits of precisionscale - the number of implied decimal digits in the
fractional part of the fieldsigned - boolean true if the value is signedsignTrailing - true if the sign is stored at the end of the fieldsignExternal - true if the sign is stored in a separate byteblankWhenZero - true if the field is all spaces when zeroExternalDecimalAsBigDecimalField.ExternalDecimalAsBigDecimalField(int, int, int, boolean, boolean, boolean, boolean)public ExternalDecimalAsBigIntegerField getExternalDecimalAsBigIntegerField(int precision, boolean signed)
precision - the number of decimal digits of precisionsigned - boolean true if the value is signedExternalDecimalAsBigIntegerField.ExternalDecimalAsBigIntegerField(int, int, int, boolean, boolean, boolean, boolean)public ExternalDecimalAsBigIntegerField getExternalDecimalAsBigIntegerField(int precision, int scale, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision - the number of decimal digits of precisionscale - the number of implied decimal digits in the
fractional part of the fieldsigned - boolean true if the value is signedsignTrailing - true if the sign is stored at the end of the fieldsignExternal - true if the sign is stored in a separate byteblankWhenZero - true if the field is all spaces when zeroExternalDecimalAsBigIntegerField.ExternalDecimalAsBigIntegerField(int, int, int, boolean, boolean, boolean, boolean)public ExternalDecimalAsIntField getExternalDecimalAsIntField(int precision, boolean signed)
precision - the number of decimal digits of precisionsigned - boolean true if the value is signedExternalDecimalAsIntField.ExternalDecimalAsIntField(int, int, boolean, boolean, boolean, boolean)public ExternalDecimalAsIntField getExternalDecimalAsIntField(int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision - the number of decimal digits of precisionsigned - boolean true if the value is signedsignTrailing - true if the sign is stored at the end of the fieldsignExternal - true if the sign is stored in a separate byteblankWhenZero - true if the field is all spaces when zeroExternalDecimalAsIntField.ExternalDecimalAsIntField(int, int, boolean, boolean, boolean, boolean)public ExternalDecimalAsLongField getExternalDecimalAsLongField(int precision, boolean signed)
precision - the number of decimal digits of precisionsigned - boolean true if the value is signedExternalDecimalAsLongField.ExternalDecimalAsLongField(int, int, boolean, boolean, boolean, boolean)public ExternalDecimalAsLongField getExternalDecimalAsLongField(int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision - the number of decimal digits of precisionsigned - boolean true if the value is signedsignTrailing - true if the sign is stored at the end of the fieldsignExternal - true if the sign is stored in a separate byteblankWhenZero - true if the field is all spaces when zeroExternalDecimalAsLongField.ExternalDecimalAsLongField(int, int, boolean, boolean, boolean, boolean)public Field getExternalDecimalField(int precision, int scale, boolean signed, boolean signTailing, boolean signExternal, boolean blankWhenZero)
precision - the number of decimal digits of precisionscale - the number of implied decimal digits in the
fractional part of the fieldsigned - boolean true if the value is signedsignTailing - true if the sign is stored at the end of the fieldsignExternal - true if the sign is stored in a separate byteblankWhenZero - true if the field is all spaces when zeroExternalDecimalAsIntField,
ExternalDecimalAsLongField,
ExternalDecimalAsBigIntegerField,
ExternalDecimalAsBigDecimalFieldpublic ByteArrayField getByteArrayField(int length)
length - the size of the field in bytesByteArrayField.ByteArrayField(int, int)public IbmFloatField getIbmFloatField()
public IbmDoubleField getIbmDoubleField()
public PackedDecimalAsBigDecimalField getPackedDecimalAsBigDecimalField(int precision, int scale, boolean signed)
precision - the number of decimal digits of precisionscale - the number of implied decimal digits to the right of the decimal pointsigned - boolean true if the value is signedPackedDecimalAsBigDecimalField.PackedDecimalAsBigDecimalField(int, int, int, boolean)public PackedDecimalAsBigIntegerField getPackedDecimalAsBigIntegerField(int precision, int scale, boolean signed)
precision - the number of decimal digits of precisionscale - the number of implied decimal digits to the right of the decimal pointsigned - boolean true if the value is signedPackedDecimalAsBigIntegerField.PackedDecimalAsBigIntegerField(int, int, int, boolean)public PackedDecimalAsIntField getPackedDecimalAsIntField(int precision, boolean signed)
precision - the number of decimal digits of precisionsigned - boolean true if the value is signedPackedDecimalAsIntField.PackedDecimalAsIntField(int, int, boolean)public PackedDecimalAsLongField getPackedDecimalAsLongField(int precision, boolean signed)
precision - the number of decimal digits of precisionsigned - boolean true if the value is signedPackedDecimalAsLongField.PackedDecimalAsLongField(int, int, boolean)public abstract Field getPackedDecimalField(int precision, int scale, boolean signed)
precision - the length of the field in decimal digitsscale - the number of digits to the right of the decimal pointsigned - true if the field is signed, false if unsignedPackedDecimalAsIntField,
PackedDecimalAsLongField,
PackedDecimalAsBigIntegerField,
PackedDecimalAsBigDecimalFieldpublic StringField getStringField(int length)
length - the length of the field in bytes.public StringField getStringField(int length, boolean trim)
length - trim - StringField.StringField(int, int, boolean)public StringField getStringField(int length, boolean trim, boolean padLeft, boolean allowTruncation, java.lang.String encoding)
length - the length of the field in bytes.trim - true if the String returned from the underlying byte array is to be trimmed of
leading (padLeft == true) or trailing (padLeft == false) blanks.padLeft - true if small values are to be left-padded
with blanksallowTruncation - true if large Strings are to be
right-truncated. If false an IllegalArgumentException will
be thrown.encoding - the character set encoding. This is assumed to be an EBCDIC variant.public StringField getStringField(int length, boolean trim, boolean padLeft, boolean allowTruncation)
length - the length of the field in bytes.trim - true if the String returned from the underlying byte array is to be trimmed of
leading (padLeft == true) or trailing (padLeft == false) blanks.padLeft - true if small values are to be left-padded
with blanksallowTruncation - true if large Strings are to be
right-truncated. If false an IllegalArgumentException will
be thrown.public StringField getStringField(int length, boolean trim, boolean padLeft)
length - the length of the field in bytes.trim - true if the String returned from the underlying byte array is to be trimmed of
leading (padLeft == true) or trailing (padLeft == false) blanks.padLeft - true if small values are to be left-padded
with blanks