Module org.eclipse.persistence.core
Class AbstractRecord
- java.lang.Object
-
- org.eclipse.persistence.internal.core.sessions.CoreAbstractRecord
-
- org.eclipse.persistence.internal.sessions.AbstractRecord
-
- All Implemented Interfaces:
Serializable,Cloneable,Map,DataRecord
- Direct Known Subclasses:
DatabaseRecord,EISMappedRecord,XMLRecord
public abstract class AbstractRecord extends CoreAbstractRecord implements DataRecord, 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 classAbstractRecord.EntrySetDefines the virtual entrySet.protected classAbstractRecord.KeySetDefines the virtual keySet.static classAbstractRecord.NoEntryINTERNAL: 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 classAbstractRecord.RecordEntryEntry class for implementing Map interface.protected classAbstractRecord.RecordEntryIteratorDefines the virtual entrySet iterator.protected classAbstractRecord.RecordKeyIteratorDefines the virtual keySet iterator.protected classAbstractRecord.RecordValuesIteratorDefines the virtual valuesSet iterator.protected classAbstractRecord.ValuesSetDefines the virtual valuesSet.
-
Field Summary
Fields Modifier and Type Field Description protected Vector<DatabaseField>fieldsUse vector to store the fields/values for optimal performance.protected DatabaseFieldlookupFieldOptimize field creation for field name lookup.static AbstractRecord.NoEntrynoEntryINTERNAL: indicator showing that no entry exists for a given key.protected booleannullValueInFieldsINTERNAL: flag for any database field containing a null valueprotected intsizePERF: Cache the row size.protected ObjectsopObjectINTERNAL: SerializedObjectPolicy supportprotected VectorvaluesUse vector to store the fields/values for optimal performance.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRecord()INTERNAL: converts JDBC results to collections of rows.protectedAbstractRecord(int initialCapacity)INTERNAL: converts JDBC results to collections of rows.protectedAbstractRecord(Vector fields, Vector values)INTERNAL: converts JDBC results to collections of rows.protectedAbstractRecord(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 voidadd(DatabaseField key, Object value)INTERNAL: Add the field-value pair to the row.voidclear()PUBLIC: Clear the contents of the row.AbstractRecordclone()INTERNAL: Clone the row and its values.booleancontains(Object value)PUBLIC: Check if the value is contained in the row.booleancontainsKey(Object key)PUBLIC: Check if the field is contained in the row.booleancontainsKey(String fieldName)PUBLIC: Check if the field is contained in the row.booleancontainsKey(DatabaseField key)INTERNAL: Check if the field is contained in the row.booleancontainsValue(Object value)PUBLIC: Check if the value is contained in the row.Enumerationelements()PUBLIC: Returns an Enumeration of the values.SetentrySet()PUBLIC: Returns a set of the keys.Objectget(Object key)PUBLIC: Retrieve the value for the field name.Objectget(String fieldName)PUBLIC: Retrieve the value for the field name.Objectget(DatabaseField key)INTERNAL: Retrieve the value for the field.DatabaseFieldgetField(DatabaseField key)INTERNAL: Returns the row's field with the same name.Vector<DatabaseField>getFields()INTERNAL:ObjectgetIndicatingNoEntry(String fieldName)PUBLIC: Retrieve the value for the field name.ObjectgetIndicatingNoEntry(DatabaseField key)INTERNAL: Retrieve the value for the field.protected DatabaseFieldgetLookupField(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 checkObjectgetSopObject()INTERNAL:VectorgetValues()INTERNAL:ObjectgetValues(String key)ObjectgetValues(DatabaseField key)booleanhasNullValueInFields()INTERNAL: Return true if the AbstractRecord has been marked as valid to check the update call cache with, false otherwise.booleanhasSopObject()INTERNAL:booleanisEmpty()PUBLIC: Return if the row is empty.Enumerationkeys()PUBLIC: Returns an Enumeration of the DatabaseField objects.SetkeySet()PUBLIC: Returns a set of the keys.voidmergeFrom(AbstractRecord row)INTERNAL: Merge the provided row into this row.Objectput(Object key, Object value)PUBLIC: Add the field-value pair to the row.Objectput(String key, Object value)PUBLIC: Add the field-value pair to the row.Objectput(DatabaseField key, Object value)INTERNAL: Add the field-value pair to the row.voidputAll(Map map)PUBLIC: Add all of the elements.Objectremove(Object key)INTERNAL: Remove the field key from the row.Objectremove(String fieldName)INTERNAL: Remove the field key from the row.Objectremove(DatabaseField key)INTERNAL: Remove the field key from the row.voidreplaceAt(Object value, int index)INTERNAL: replaces the value at index with valuevoidreplaceAt(Object value, DatabaseField key)INTERNAL: replaces the value at field with valueprotected voidresetSize()Reset the row size.protected voidsetFields(Vector fields)voidsetNullValueInFields(boolean nullValueInFields)INTERNAL: Set the validForUpdateCallCacheCheck attribute to true if the row does not contain nulls, false otherwisevoidsetSopObject(Object sopObject)INTERNAL:protected voidsetValues(Vector values)intsize()PUBLIC: Return the number of field/value pairs in the row.StringtoString()INTERNAL:Collectionvalues()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
protected AbstractRecord()
INTERNAL: converts JDBC results to collections of rows.
-
AbstractRecord
protected AbstractRecord(int initialCapacity)
INTERNAL: converts JDBC results to collections of rows.
-
AbstractRecord
protected 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:
containsKeyin 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:
containsValuein 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
-
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:
putin 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:
-
-