Class AbstractRecord
- java.lang.Object
-
- org.eclipse.persistence.internal.core.sessions.CoreAbstractRecord
-
- org.eclipse.persistence.internal.sessions.AbstractRecord
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map
,Record
- Direct Known Subclasses:
DatabaseRecord
,EISMappedRecord
,XMLRecord
public abstract class AbstractRecord extends CoreAbstractRecord implements Record, Cloneable, Serializable, Map
Purpose: Define the abstract definition of a record for internal use. Public API should reference the Map or Record interface. Subclasses are DatabaseRecord and XMLRecord.
Responsibilities:
- Implement the Record and Map interfaces.
- See Also:
DatabaseField
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractRecord.EntrySet
Defines the virtual entrySet.protected class
AbstractRecord.KeySet
Defines the virtual keySet.static class
AbstractRecord.NoEntry
INTERNAL: NoEntry: This is used to differentiate between the two kinds of nulls: no entry exists, and the field is actually mapped to null.protected static class
AbstractRecord.RecordEntry
Entry class for implementing Map interface.protected class
AbstractRecord.RecordEntryIterator
Defines the virtual entrySet iterator.protected class
AbstractRecord.RecordKeyIterator
Defines the virtual keySet iterator.protected class
AbstractRecord.RecordValuesIterator
Defines the virtual valuesSet iterator.protected class
AbstractRecord.ValuesSet
Defines the virtual valuesSet.
-
Field Summary
Fields Modifier and Type Field Description protected Vector<DatabaseField>
fields
Use vector to store the fields/values for optimal performance.protected DatabaseField
lookupField
Optimize field creation for field name lookup.static AbstractRecord.NoEntry
noEntry
INTERNAL: indicator showing that no entry exists for a given key.protected boolean
nullValueInFields
INTERNAL: flag for any database field containing a null valueprotected int
size
PERF: Cache the row size.protected Object
sopObject
INTERNAL: SerializedObjectPolicy supportprotected Vector
values
Use vector to store the fields/values for optimal performance.
-
Constructor Summary
Constructors Constructor Description AbstractRecord()
INTERNAL: converts JDBC results to collections of rows.AbstractRecord(int initialCapacity)
INTERNAL: converts JDBC results to collections of rows.AbstractRecord(Vector fields, Vector values)
INTERNAL: converts JDBC results to collections of rows.AbstractRecord(Vector fields, Vector values, int size)
INTERNAL: converts JDBC results to collections of rows.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(DatabaseField key, Object value)
INTERNAL: Add the field-value pair to the row.void
clear()
PUBLIC: Clear the contents of the row.AbstractRecord
clone()
INTERNAL: Clone the row and its values.boolean
contains(Object value)
PUBLIC: Check if the value is contained in the row.boolean
containsKey(Object key)
PUBLIC: Check if the field is contained in the row.boolean
containsKey(String fieldName)
PUBLIC: Check if the field is contained in the row.boolean
containsKey(DatabaseField key)
INTERNAL: Check if the field is contained in the row.boolean
containsValue(Object value)
PUBLIC: Check if the value is contained in the row.Enumeration
elements()
PUBLIC: Returns an Enumeration of the values.Set
entrySet()
PUBLIC: Returns a set of the keys.Object
get(Object key)
PUBLIC: Retrieve the value for the field name.Object
get(String fieldName)
PUBLIC: Retrieve the value for the field name.Object
get(DatabaseField key)
INTERNAL: Retrieve the value for the field.DatabaseField
getField(DatabaseField key)
INTERNAL: Returns the row's field with the same name.Vector<DatabaseField>
getFields()
INTERNAL:Object
getIndicatingNoEntry(String fieldName)
PUBLIC: Retrieve the value for the field name.Object
getIndicatingNoEntry(DatabaseField key)
INTERNAL: Retrieve the value for the field.protected DatabaseField
getLookupField(String fieldName)
Internal: factored out of getIndicatingNoEntry(String) to reduce complexity and have get(string) use get(DatabaseField) instead of getIndicatingNoEntry and then doing an extra checkObject
getSopObject()
INTERNAL:Vector
getValues()
INTERNAL:Object
getValues(String key)
Object
getValues(DatabaseField key)
boolean
hasNullValueInFields()
INTERNAL: Return true if the AbstractRecord has been marked as valid to check the update call cache with, false otherwise.boolean
hasSopObject()
INTERNAL:boolean
isEmpty()
PUBLIC: Return if the row is empty.Enumeration
keys()
PUBLIC: Returns an Enumeration of the DatabaseField objects.Set
keySet()
PUBLIC: Returns a set of the keys.void
mergeFrom(AbstractRecord row)
INTERNAL: Merge the provided row into this row.Object
put(Object key, Object value)
PUBLIC: Add the field-value pair to the row.Object
put(String key, Object value)
PUBLIC: Add the field-value pair to the row.Object
put(DatabaseField key, Object value)
INTERNAL: Add the field-value pair to the row.void
putAll(Map map)
PUBLIC: Add all of the elements.Object
remove(Object key)
INTERNAL: Remove the field key from the row.Object
remove(String fieldName)
INTERNAL: Remove the field key from the row.Object
remove(DatabaseField key)
INTERNAL: Remove the field key from the row.void
replaceAt(Object value, int index)
INTERNAL: replaces the value at index with valuevoid
replaceAt(Object value, DatabaseField key)
INTERNAL: replaces the value at field with valueprotected void
resetSize()
Reset the row size.protected void
setFields(Vector fields)
void
setNullValueInFields(boolean nullValueInFields)
INTERNAL: Set the validForUpdateCallCacheCheck attribute to true if the row does not contain nulls, false otherwisevoid
setSopObject(Object sopObject)
INTERNAL:protected void
setValues(Vector values)
int
size()
PUBLIC: Return the number of field/value pairs in the row.String
toString()
INTERNAL:Collection
values()
PUBLIC: Returns an collection of the values.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Field Detail
-
fields
protected Vector<DatabaseField> fields
Use vector to store the fields/values for optimal performance.
-
values
protected Vector values
Use vector to store the fields/values for optimal performance.
-
lookupField
protected DatabaseField lookupField
Optimize field creation for field name lookup.
-
size
protected int size
PERF: Cache the row size.
-
noEntry
public static final AbstractRecord.NoEntry noEntry
INTERNAL: indicator showing that no entry exists for a given key.
-
nullValueInFields
protected boolean nullValueInFields
INTERNAL: flag for any database field containing a null value
-
sopObject
protected transient Object sopObject
INTERNAL: SerializedObjectPolicy support
-
-
Constructor Detail
-
AbstractRecord
public AbstractRecord()
INTERNAL: converts JDBC results to collections of rows.
-
AbstractRecord
public AbstractRecord(int initialCapacity)
INTERNAL: converts JDBC results to collections of rows.
-
AbstractRecord
public AbstractRecord(Vector fields, Vector values)
INTERNAL: converts JDBC results to collections of rows.
-
-
Method Detail
-
resetSize
protected void resetSize()
Reset the row size. This must be reset after any change to the row.
-
add
public void add(DatabaseField key, Object value)
INTERNAL: Add the field-value pair to the row. Will not check, will simply add to the end of the row
-
clear
public void clear()
PUBLIC: Clear the contents of the row.
-
clone
public AbstractRecord clone()
INTERNAL: Clone the row and its values.
-
contains
public boolean contains(Object value)
PUBLIC: Check if the value is contained in the row.
-
containsKey
public boolean containsKey(Object key)
PUBLIC: Check if the field is contained in the row. Conform to hashtable interface.- Specified by:
containsKey
in interfaceMap
-
containsKey
public boolean containsKey(String fieldName)
PUBLIC: Check if the field is contained in the row.
-
containsKey
public boolean containsKey(DatabaseField key)
INTERNAL: Check if the field is contained in the row.
-
containsValue
public boolean containsValue(Object value)
PUBLIC: Check if the value is contained in the row.- Specified by:
containsValue
in interfaceMap
-
elements
public Enumeration elements()
PUBLIC: Returns an Enumeration of the values.
-
entrySet
public Set entrySet()
PUBLIC: Returns a set of the keys.
-
get
public Object get(Object key)
PUBLIC: Retrieve the value for the field name. A field is constructed on the name to check the hash table. If missing null is returned.
-
get
public Object get(String fieldName)
PUBLIC: Retrieve the value for the field name. A field is constructed on the name to check the hash table. If missing null is returned.
-
getLookupField
protected DatabaseField getLookupField(String fieldName)
Internal: factored out of getIndicatingNoEntry(String) to reduce complexity and have get(string) use get(DatabaseField) instead of getIndicatingNoEntry and then doing an extra check- Parameters:
fieldName
-- Returns:
-
getIndicatingNoEntry
public Object getIndicatingNoEntry(String fieldName)
PUBLIC: Retrieve the value for the field name. A field is constructed on the name to check the hash table. If missing DatabaseRow.noEntry is returned.
-
get
public Object get(DatabaseField key)
INTERNAL: Retrieve the value for the field. If missing null is returned.
-
getValues
public Object getValues(DatabaseField key)
-
getIndicatingNoEntry
public Object getIndicatingNoEntry(DatabaseField key)
INTERNAL: Retrieve the value for the field. If missing DatabaseRow.noEntry is returned.
-
getField
public DatabaseField getField(DatabaseField key)
INTERNAL: Returns the row's field with the same name.
-
getFields
public Vector<DatabaseField> getFields()
INTERNAL:
-
getValues
public Vector getValues()
INTERNAL:
-
isEmpty
public boolean isEmpty()
PUBLIC: Return if the row is empty.
-
hasNullValueInFields
public boolean hasNullValueInFields()
INTERNAL: Return true if the AbstractRecord has been marked as valid to check the update call cache with, false otherwise.
-
keys
public Enumeration keys()
PUBLIC: Returns an Enumeration of the DatabaseField objects.
-
mergeFrom
public void mergeFrom(AbstractRecord row)
INTERNAL: Merge the provided row into this row. Existing field values in this row will be replaced with values from the provided row. Fields not in this row will be added from provided row. Values not in provided row will remain in this row.
-
put
public Object put(Object key, Object value) throws ValidationException
PUBLIC: Add the field-value pair to the row.- Specified by:
put
in interfaceMap
- Throws:
ValidationException
-
put
public Object put(DatabaseField key, Object value)
INTERNAL: Add the field-value pair to the row.
-
putAll
public void putAll(Map map)
PUBLIC: Add all of the elements.
-
remove
public Object remove(DatabaseField key)
INTERNAL: Remove the field key from the row.
-
replaceAt
public void replaceAt(Object value, int index)
INTERNAL: replaces the value at index with value
-
replaceAt
public void replaceAt(Object value, DatabaseField key)
INTERNAL: replaces the value at field with value
-
setFields
protected void setFields(Vector fields)
-
setNullValueInFields
public void setNullValueInFields(boolean nullValueInFields)
INTERNAL: Set the validForUpdateCallCacheCheck attribute to true if the row does not contain nulls, false otherwise
-
setValues
protected void setValues(Vector values)
-
size
public int size()
PUBLIC: Return the number of field/value pairs in the row.
-
values
public Collection values()
PUBLIC: Returns an collection of the values.
-
hasSopObject
public boolean hasSopObject()
INTERNAL:
-
getSopObject
public Object getSopObject()
INTERNAL:
-
setSopObject
public void setSopObject(Object sopObject)
INTERNAL:
-
-