public interface DatabaseEntry extends DatabaseTypes
BOOLEAN, BYTE_ARRAY, CREATED_FIELD, DATE, DATE_TIME, DECIMAL, DOUBLE, FIRST_SPECIAL_FIELD, FLAG_SYNCHRONIZED, FLAGS_FIELD, INTEGER, JAVA_OBJECT, LONG, MAX_ID, MODIFIED_BY_FIELD, MODIFIED_FIELD, NAME_FIELD, OBJECT_BYTES_FIELD, OBJECT_TEXT_FIELD, OID_FIELD, OPTION_ERROR_ON_NEED_REINDEX, PLAIN_DATE, PLAIN_TIME, reservedFieldHeaders, reservedFieldIDs, reservedFieldNames, reservedFieldTypes, SORT_DATE_ONLY, SORT_IGNORE_CASE, SORT_TIME_ONLY, SORT_UNKNOWN_IS_GREATER_THAN_KNOWN, SORT_UNKNOWN_IS_LESS_THAN_KNOWN, STRING, TIME, TIMESTAMP
Modifier and Type | Method and Description |
---|---|
void |
clearDataAndSpecialFields()
Clears the data fields and the special fields.
|
void |
clearField(int fieldID)
Set the specified field to be unassigned.
|
void |
clearFields()
Clears the data fields but not the special fields.
|
int |
compareTo(DatabaseEntry other,
int sortID)
Compare this entry with another based on the sortID stored in the database (ignoring
the SORT_DESCENDING option).
|
int |
compareTo(DatabaseEntry other,
int[] sortCriteria,
boolean hasWildCards)
Compare this entry with another based on an arbitrary sort criteria.
|
int |
countAssignedFields() |
boolean |
decode(byte[] data,
int offset,
int length) |
void |
decode(byte[] data,
int offset,
int length,
DataProcessor decryptor)
Decode an encoded DatabaseEntry.
|
void |
delete()
This will delete the entry from the database.
|
void |
duplicateFrom(DatabaseEntry other)
Duplicate all set fields in this DatabaseEntry with those from the other.
|
byte[] |
encode() |
ByteArray |
encode(ByteArray dest,
DataProcessor encryptor)
Encode and append the data to the supplied ByteArray object.
|
void |
erase()
This will erase the entry from the database.
|
int[] |
getAssignedFields() |
int |
getAssignedFields(int[] dest,
int offset) |
Object |
getData()
Get the data from the entry, creating a new data object.
|
Object |
getData(Object destination)
Get the data from the entry into a data object.
|
Database |
getDatabase()
Get the database associated with the FoundEntries.
|
BigDecimal |
getField(int fieldID,
BigDecimal defaultValue) |
BigDecimal |
getField(int fieldID,
BigDecimal defaultValue) |
boolean |
getField(int fieldID,
boolean defaultValue) |
ByteArray |
getField(int fieldID,
ByteArray dest) |
CharArray |
getField(int fieldID,
CharArray dest) |
DayOfYear |
getField(int fieldID,
DayOfYear dest) |
Decimal |
getField(int fieldID,
Decimal dest) |
double |
getField(int fieldID,
double defaultValue) |
int |
getField(int fieldID,
int defaultValue) |
long |
getField(int fieldID,
long defaultValue) |
String |
getField(int fieldID,
String defaultValue) |
Time |
getField(int fieldID,
Time dest) |
TimeOfDay |
getField(int fieldID,
TimeOfDay dest) |
TimeStamp |
getField(int fieldID,
TimeStamp dest) |
byte[] |
getFieldBytes(int fieldID) |
Wrapper |
getFieldValue(int fieldID,
int type,
Object destDataOrDestWrapper)
Get the data stored in a Wrapper.
|
Wrapper |
getFieldValue(int fieldID,
Object destDataOrDestWrapper)
Get the data stored in a Wrapper, assuming that the type of the field will be known
to the DatabaseEntry.
|
void |
getFieldValues(int[] fieldIDs,
Object[] destinationObjectsAndWrappers)
Get a set of fields from the DatabaseEntry.
|
Object |
getObjectField(int fieldID,
Object dest) |
boolean |
hasField(int ID) |
boolean |
isADeletedEntry() |
boolean |
isPointingTo(DatabaseEntry other) |
boolean |
isSaved() |
void |
pointTo(DatabaseEntry other) |
void |
reset()
Reset the entry to be an empty entry, as if it had just been returned by Database.getNewData()
|
void |
revert()
Reload the entries data.
|
void |
save()
This will save or add the entry into the database.
|
void |
setData(Object data)
Set the data in the entry from the data object.
|
void |
setField(int fieldID,
BigDecimal value) |
void |
setField(int fieldID,
BigDecimal value) |
void |
setField(int fieldID,
boolean value) |
void |
setField(int fieldID,
byte[] bytes) |
void |
setField(int fieldID,
ByteArray bytes) |
void |
setField(int fieldID,
CharArray chars) |
void |
setField(int fieldID,
DayOfYear value) |
void |
setField(int fieldID,
Decimal value) |
void |
setField(int fieldID,
double value) |
void |
setField(int fieldID,
int value) |
void |
setField(int fieldID,
long value) |
void |
setField(int fieldID,
String chars) |
void |
setField(int fieldID,
SubString chars) |
void |
setField(int fieldID,
Time time) |
void |
setField(int fieldID,
TimeOfDay value) |
void |
setField(int fieldID,
TimeStamp value) |
void |
setFieldValue(int fieldID,
int type,
Object data) |
void |
setFieldValue(int fieldID,
Object data) |
void |
setFieldValues(int[] fieldIDs,
Object[] sourceObjectsAndWrappers)
set a set of fields from the DatabaseEntry.
|
void |
setObjectField(int fieldID,
Object value) |
void |
store()
This will store and add (if necessary) the entry into the database with no modifications.
|
Database getDatabase()
boolean isSaved()
boolean isADeletedEntry()
boolean hasField(int ID)
int countAssignedFields()
int getAssignedFields(int[] dest, int offset)
int[] getAssignedFields()
void setField(int fieldID, int value)
void setField(int fieldID, long value)
void setField(int fieldID, boolean value)
void setField(int fieldID, double value)
void setField(int fieldID, TimeOfDay value)
void setField(int fieldID, DayOfYear value)
void setField(int fieldID, TimeStamp value)
void setField(int fieldID, Time time)
void setField(int fieldID, ByteArray bytes)
void setField(int fieldID, byte[] bytes)
void setField(int fieldID, SubString chars)
void setField(int fieldID, CharArray chars)
void setField(int fieldID, String chars)
void setField(int fieldID, BigDecimal value)
void setField(int fieldID, BigDecimal value)
void setField(int fieldID, Decimal value)
void setObjectField(int fieldID, Object value)
void setFieldValue(int fieldID, int type, Object data)
void setFieldValue(int fieldID, Object data)
Wrapper getFieldValue(int fieldID, int type, Object destDataOrDestWrapper)
fieldID
- the field ID.type
- the expected type of the field.destDataOrDestWrapper
- this can be a destination Wrapper, which itself
may have a destination object already set, or it can be a destination Object
itself. The destination Object is NOT used for primitive types such as INTEGER, LONG,
DOUBLE or BOOLEAN, but a destination Wrapper can be used. The acceptable destination objects for other types are:
BYTE_ARRAY - eve.util.ByteArray STRING - eve.util.CharArray PLAIN_DATE - eve.data.PlainDate PLAIN_TIME - eve.data.PlainTime DATE_TIME - eve.sys.Time DATE - eve.sys.DayOfYear TIME - eve.sys.TimeOfDay DECIMAL - eve.sys.Decimal TIMESTAMP - eve.database.TimeStamp
Wrapper getFieldValue(int fieldID, Object destDataOrDestWrapper)
fieldID
- the field ID.destDataOrDestWrapper
- this can be a destination Wrapper, which itself
may have a destination object already set, or it can be a destination Object
itself. The destination Object is NOT used for primitive types such as INTEGER, LONG,
DOUBLE or BOOLEAN, but a destination Wrapper can be used. The acceptable destination objects for other types are:
BYTE_ARRAY - eve.util.ByteArray STRING - eve.util.CharArray PLAIN_DATE - eve.data.PlainDate PLAIN_TIME - eve.data.PlainTime DATE_TIME - eve.sys.Time DATE - eve.sys.DayOfYear TIME - eve.sys.TimeOfDay DECIMAL - eve.sys.Decimal TIMESTAMP - eve.database.TimeStamp
int getField(int fieldID, int defaultValue)
long getField(int fieldID, long defaultValue)
boolean getField(int fieldID, boolean defaultValue)
double getField(int fieldID, double defaultValue)
BigDecimal getField(int fieldID, BigDecimal defaultValue)
BigDecimal getField(int fieldID, BigDecimal defaultValue)
byte[] getFieldBytes(int fieldID)
void save() throws IllegalStateException, IOException
IllegalStateException
- if the entry is a deleted entry or otherwise cannot be saved.IOException
- on error.void store() throws IllegalStateException, IOException
IllegalStateException
- if the entry is a deleted entry or otherwise cannot be saved.IOException
- on error.void delete() throws IOException
IOException
- on error.void erase() throws IOException
IOException
void revert() throws IllegalStateException, IOException
IllegalStateException
- if the entry's data could not be reloaded, because
it was deleted, erased or reset.IOException
void reset()
void clearField(int fieldID)
void clearFields()
void clearDataAndSpecialFields()
int compareTo(DatabaseEntry other, int sortID) throws IllegalArgumentException
IllegalArgumentException
int compareTo(DatabaseEntry other, int[] sortCriteria, boolean hasWildCards) throws IllegalArgumentException
IllegalArgumentException
Object getData(Object destination) throws IllegalArgumentException, IllegalStateException
destination
- a destination object. If this is null a new one will be created if
possible.IllegalArgumentException
- if the destination object is not the right type.IllegalStateException
- if a new object was requested but could not be created.Object getData() throws IllegalStateException
IllegalStateException
- if a new object could not be created.void setData(Object data) throws IllegalArgumentException
data
- the data to set.IllegalArgumentException
- if the data object is the wrong type.void pointTo(DatabaseEntry other) throws IllegalArgumentException
IllegalArgumentException
boolean isPointingTo(DatabaseEntry other) throws IllegalArgumentException
IllegalArgumentException
void decode(byte[] data, int offset, int length, DataProcessor decryptor) throws IOException
data
- the encoded data bytes.offset
- the start of the data.length
- the number of data bytes.decryptor
- an optional decryptor for decoding.IOException
- if the data is invalid or if the decryptor failed during decryption.ByteArray encode(ByteArray dest, DataProcessor encryptor) throws IOException
dest
- the destination ByteArray object.encryptor
- an optional encryptor for encrypting the data.IOException
- if the encryptor failed during decryption.boolean decode(byte[] data, int offset, int length)
byte[] encode()
void duplicateFrom(DatabaseEntry other)
void getFieldValues(int[] fieldIDs, Object[] destinationObjectsAndWrappers)
fieldIDs
- the field IDs.destinationObjectsAndWrappers
- the destination Object and/or Wrappers
to hold the data. See getFieldValue() to see the destination types to use.void setFieldValues(int[] fieldIDs, Object[] sourceObjectsAndWrappers)
fieldIDs
- the field IDs.sourceObjectsAndWrappers
- the source Object and/or Wrappers
to hold the data. See getFieldValue() to see the destination types to use.