Package db
Class BinaryCodedField
java.lang.Object
db.Field
db.BinaryField
db.BinaryCodedField
- All Implemented Interfaces:
Comparable<Field>
Allows various non-database supported data types to be
encoded within a BinaryField which may be stored within the
database.
Although the BinaryField stores a byte array, this type is supported by this class so that the use of a BinaryField within a table can always relate to this class and still support a byte array.
-
Nested Class Summary
Nested classes/interfaces inherited from class db.Field
Field.UnsupportedFieldException
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte
byte[] data typestatic final byte
double data typestatic final byte
double[] data typestatic final byte
float data typestatic final byte
float[] data typestatic final byte
int[] data typestatic final byte
long[] data typestatic final byte
short data typestatic final byte
String[] data typeFields inherited from class db.BinaryField
data, INSTANCE
Fields inherited from class db.Field
EMPTY_ARRAY
-
Constructor Summary
ConstructorDescriptionBinaryCodedField
(byte[] values) Construct a coded field from a byte array.BinaryCodedField
(double value) Construct a coded field from a double value.BinaryCodedField
(double[] values) Construct a coded field from a double array.BinaryCodedField
(float value) Construct a coded field from a float value.BinaryCodedField
(float[] values) Construct a coded field from a float array.BinaryCodedField
(int[] values) Construct a coded field from a int array.BinaryCodedField
(long[] values) Construct a coded field from a long array.BinaryCodedField
(short[] values) Construct a coded field from a short array.BinaryCodedField
(BinaryField binField) Construct a coded field from an existing binary field.BinaryCodedField
(String[] strings) Construct a coded field from a String array. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Get the byte array contained with this field.byte
Get the data type associated with this field.double[]
Get the double array contained with this field.double
Get the double value contained with this field.float[]
Get the float array contained with this field.float
Get the float value contained with this field.int[]
Get the int array contained with this field.long[]
Get the long array contained with this field.short[]
Get the short array contained with this field.String[]
Get the String array contained with this field.Methods inherited from class db.BinaryField
compareTo, copyField, equals, getBinaryData, getValueAsString, getValueAsString, hashCode, isNull, isVariableLength, newField, setBinaryData, toString
Methods inherited from class db.Field
canIndex, getBooleanValue, getByteValue, getIntValue, getLongValue, getShortValue, getString, isSameType, setBooleanValue, setByteValue, setIntValue, setLongValue, setShortValue, setString
-
Field Details
-
BYTE_ARRAY
public static final byte BYTE_ARRAYbyte[] data type- See Also:
-
FLOAT
public static final byte FLOATfloat data type- See Also:
-
DOUBLE
public static final byte DOUBLEdouble data type- See Also:
-
SHORT_ARRAY
public static final byte SHORT_ARRAYshort data type- See Also:
-
INT_ARRAY
public static final byte INT_ARRAYint[] data type- See Also:
-
LONG_ARRAY
public static final byte LONG_ARRAYlong[] data type- See Also:
-
FLOAT_ARRAY
public static final byte FLOAT_ARRAYfloat[] data type- See Also:
-
DOUBLE_ARRAY
public static final byte DOUBLE_ARRAYdouble[] data type- See Also:
-
STRING_ARRAY
public static final byte STRING_ARRAYString[] data type- See Also:
-
-
Constructor Details
-
BinaryCodedField
Construct a coded field from an existing binary field.- Parameters:
binField
- the binary field
-
BinaryCodedField
public BinaryCodedField(double value) Construct a coded field from a double value.- Parameters:
value
- the double value
-
BinaryCodedField
public BinaryCodedField(float value) Construct a coded field from a float value.- Parameters:
value
- the float value
-
BinaryCodedField
public BinaryCodedField(byte[] values) Construct a coded field from a byte array.- Parameters:
values
- byte array
-
BinaryCodedField
public BinaryCodedField(short[] values) Construct a coded field from a short array.- Parameters:
values
- short array
-
BinaryCodedField
public BinaryCodedField(int[] values) Construct a coded field from a int array.- Parameters:
values
- int array
-
BinaryCodedField
public BinaryCodedField(long[] values) Construct a coded field from a long array.- Parameters:
values
- long array
-
BinaryCodedField
public BinaryCodedField(float[] values) Construct a coded field from a float array.- Parameters:
values
- float array
-
BinaryCodedField
public BinaryCodedField(double[] values) Construct a coded field from a double array.- Parameters:
values
- double array
-
BinaryCodedField
Construct a coded field from a String array.- Parameters:
strings
- String array
-
-
Method Details
-
getDataType
public byte getDataType()Get the data type associated with this field.- Returns:
- data type
-
getDoubleValue
public double getDoubleValue()Get the double value contained with this field.- Returns:
- double value
- Throws:
IllegalFieldAccessException
- if data type is not DOUBLE.
-
getFloatValue
public float getFloatValue()Get the float value contained with this field.- Returns:
- float value
- Throws:
IllegalFieldAccessException
- if data type is not FLOAT.
-
getByteArray
public byte[] getByteArray()Get the byte array contained with this field.- Returns:
- byte array
- Throws:
IllegalFieldAccessException
- if data type is not BYTE_ARRAY.
-
getShortArray
public short[] getShortArray()Get the short array contained with this field.- Returns:
- short array
- Throws:
IllegalFieldAccessException
- if data type is not SHORT_ARRAY.
-
getIntArray
public int[] getIntArray()Get the int array contained with this field.- Returns:
- int array
- Throws:
IllegalFieldAccessException
- if data type is not INT_ARRAY.
-
getLongArray
public long[] getLongArray()Get the long array contained with this field.- Returns:
- long array
- Throws:
IllegalFieldAccessException
- if data type is not LONG_ARRAY.
-
getFloatArray
public float[] getFloatArray()Get the float array contained with this field.- Returns:
- float array
- Throws:
IllegalFieldAccessException
- if data type is not FLOAT_ARRAY.
-
getDoubleArray
public double[] getDoubleArray()Get the double array contained with this field.- Returns:
- double array
- Throws:
IllegalFieldAccessException
- if data type is not DOUBLE_ARRAY.
-
getStringArray
Get the String array contained with this field.- Returns:
- String array
- Throws:
IllegalFieldAccessException
- if data type is not STRING_ARRAY.
-