Package db
Class BinaryCodedField
- java.lang.Object
-
- db.Field
-
- db.BinaryField
-
- db.BinaryCodedField
-
- All Implemented Interfaces:
java.lang.Comparable<Field>
public class BinaryCodedField extends BinaryField
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.
-
-
Field Summary
Fields Modifier and Type Field Description static byte
BYTE_ARRAY
byte[] data typestatic byte
DOUBLE
double data typestatic byte
DOUBLE_ARRAY
double[] data typestatic byte
FLOAT
float data typestatic byte
FLOAT_ARRAY
float[] data typestatic byte
INT_ARRAY
int[] data typestatic byte
LONG_ARRAY
long[] data typestatic byte
SHORT_ARRAY
short data typestatic byte
STRING_ARRAY
String[] data type-
Fields inherited from class db.BinaryField
data
-
-
Constructor Summary
Constructors Constructor Description BinaryCodedField(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(java.lang.String[] strings)
Construct a coded field from a String array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getByteArray()
Get the byte array contained with this field.byte
getDataType()
Get the data type associated with this field.double[]
getDoubleArray()
Get the double array contained with this field.double
getDoubleValue()
Get the double value contained with this field.float[]
getFloatArray()
Get the float array contained with this field.float
getFloatValue()
Get the float value contained with this field.int[]
getIntArray()
Get the int array contained with this field.long[]
getLongArray()
Get the long array contained with this field.short[]
getShortArray()
Get the short array contained with this field.java.lang.String[]
getStringArray()
Get the String array contained with this field.-
Methods inherited from class db.BinaryField
compareTo, equals, getBinaryData, getFieldType, getValueAsString, hashCode, isVariableLength, newField, newField, setBinaryData, toString
-
Methods inherited from class db.Field
getBooleanValue, getByteValue, getIntValue, getLongValue, getShortValue, getString, setBooleanValue, setByteValue, setIntValue, setLongValue, setShortValue, setString
-
-
-
-
Field Detail
-
BYTE_ARRAY
public static final byte BYTE_ARRAY
byte[] data type- See Also:
- Constant Field Values
-
FLOAT
public static final byte FLOAT
float data type- See Also:
- Constant Field Values
-
DOUBLE
public static final byte DOUBLE
double data type- See Also:
- Constant Field Values
-
SHORT_ARRAY
public static final byte SHORT_ARRAY
short data type- See Also:
- Constant Field Values
-
INT_ARRAY
public static final byte INT_ARRAY
int[] data type- See Also:
- Constant Field Values
-
LONG_ARRAY
public static final byte LONG_ARRAY
long[] data type- See Also:
- Constant Field Values
-
FLOAT_ARRAY
public static final byte FLOAT_ARRAY
float[] data type- See Also:
- Constant Field Values
-
DOUBLE_ARRAY
public static final byte DOUBLE_ARRAY
double[] data type- See Also:
- Constant Field Values
-
STRING_ARRAY
public static final byte STRING_ARRAY
String[] data type- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinaryCodedField
public BinaryCodedField(BinaryField binField)
Construct a coded field from an existing binary field.- Parameters:
binary
- field
-
BinaryCodedField
public BinaryCodedField(double value)
Construct a coded field from a double value.- Parameters:
value
-
-
BinaryCodedField
public BinaryCodedField(float value)
Construct a coded field from a float value.- Parameters:
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
public BinaryCodedField(java.lang.String[] strings)
Construct a coded field from a String array.- Parameters:
strings
- String array
-
-
Method Detail
-
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
public java.lang.String[] getStringArray()
Get the String array contained with this field.- Returns:
- String array
- Throws:
IllegalFieldAccessException
- if data type is not STRING_ARRAY.
-
-