Package db
Class Field
- java.lang.Object
-
- db.Field
-
- All Implemented Interfaces:
java.lang.Comparable<Field>
- Direct Known Subclasses:
BinaryField,BooleanField,ByteField,IntField,LongField,ShortField,StringField
public abstract class Field extends java.lang.Object implements java.lang.Comparable<Field>
Fieldis an abstract data wrapper for use with Records.
-
-
Constructor Summary
Constructors Constructor Description Field()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleanequals(java.lang.Object obj)abstract byte[]getBinaryData()Get data as a byte array.booleangetBooleanValue()Get field as a boolean value.bytegetByteValue()Get field as a byte value.protected abstract bytegetFieldType()Return Field instance type as an integer valueintgetIntValue()Get field as an integer value.longgetLongValue()Get field as a long value.shortgetShortValue()Get field as a short value.java.lang.StringgetString()Get field as a String value.abstract java.lang.StringgetValueAsString()abstract inthashCode()booleanisVariableLength()abstract FieldnewField()Create new instance of this field type.abstract FieldnewField(Field fieldValue)Create new instance of this field type.voidsetBinaryData(byte[] bytes)Set data from binary byte array.voidsetBooleanValue(boolean value)Set field's boolean value.voidsetByteValue(byte value)Set field's byte value.voidsetIntValue(int value)Set field's integer value.voidsetLongValue(long value)Set field's long value.voidsetShortValue(short value)Set field's short value.voidsetString(java.lang.String str)Set field's String value.
-
-
-
Method Detail
-
getLongValue
public long getLongValue()
Get field as a long value. All fixed-length field objects must implement this method- Returns:
- long value
- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
setLongValue
public void setLongValue(long value)
Set field's long value. All fixed-length field objects must implement this method- Parameters:
value- long value- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
getIntValue
public int getIntValue()
Get field as an integer value.- Returns:
- integer value
- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
setIntValue
public void setIntValue(int value)
Set field's integer value.- Parameters:
value- integer value- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
getShortValue
public short getShortValue()
Get field as a short value.- Returns:
- short value
- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
setShortValue
public void setShortValue(short value)
Set field's short value.- Parameters:
value- short value- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
getByteValue
public byte getByteValue()
Get field as a byte value.- Returns:
- byte value
- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
setByteValue
public void setByteValue(byte value)
Set field's byte value.- Parameters:
value- byte value- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
getBooleanValue
public boolean getBooleanValue()
Get field as a boolean value.- Returns:
- boolean value
- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
setBooleanValue
public void setBooleanValue(boolean value)
Set field's boolean value.- Parameters:
value- boolean value- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
getBinaryData
public abstract byte[] getBinaryData()
Get data as a byte array.- Returns:
- byte[]
-
setBinaryData
public void setBinaryData(byte[] bytes)
Set data from binary byte array. All variable-length fields must implement this method.- Parameters:
bytes- field data
-
getString
public java.lang.String getString()
Get field as a String value.- Returns:
- String value
- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
setString
public void setString(java.lang.String str)
Set field's String value.- Parameters:
str- String value- Throws:
IllegalFieldAccessException- thrown if method is not supported by specific Field instance.
-
isVariableLength
public boolean isVariableLength()
- Returns:
- true if a Field instance is variable length, else false.
-
newField
public abstract Field newField(Field fieldValue)
Create new instance of this field type.- Parameters:
fieldValue- initial field value.- Returns:
- long
-
newField
public abstract Field newField()
Create new instance of this field type.- Returns:
- long
-
getFieldType
protected abstract byte getFieldType()
Return Field instance type as an integer value
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public abstract int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getValueAsString
public abstract java.lang.String getValueAsString()
-
-