Class AbstractRecord
- java.lang.Object
-
- org.eclipse.persistence.internal.core.sessions.CoreAbstractRecord
-
- org.eclipse.persistence.internal.sessions.AbstractRecord
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map,Record
- Direct Known Subclasses:
DatabaseRecord,EISMappedRecord,XMLRecord
public abstract class AbstractRecord extends CoreAbstractRecord implements Record, java.lang.Cloneable, java.io.Serializable, java.util.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 java.util.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 java.lang.ObjectsopObjectINTERNAL: SerializedObjectPolicy supportprotected java.util.VectorvaluesUse 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(java.util.Vector fields, java.util.Vector values)INTERNAL: converts JDBC results to collections of rows.AbstractRecord(java.util.Vector fields, java.util.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, java.lang.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(java.lang.Object value)PUBLIC: Check if the value is contained in the row.booleancontainsKey(java.lang.Object key)PUBLIC: Check if the field is contained in the row.booleancontainsKey(java.lang.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(java.lang.Object value)PUBLIC: Check if the value is contained in the row.java.util.Enumerationelements()PUBLIC: Returns an Enumeration of the values.java.util.SetentrySet()PUBLIC: Returns a set of the keys.java.lang.Objectget(java.lang.Object key)PUBLIC: Retrieve the value for the field name.java.lang.Objectget(java.lang.String fieldName)PUBLIC: Retrieve the value for the field name.java.lang.Objectget(DatabaseField key)INTERNAL: Retrieve the value for the field.DatabaseFieldgetField(DatabaseField key)INTERNAL: Returns the row's field with the same name.java.util.Vector<DatabaseField>getFields()INTERNAL:java.lang.ObjectgetIndicatingNoEntry(java.lang.String fieldName)PUBLIC: Retrieve the value for the field name.java.lang.ObjectgetIndicatingNoEntry(DatabaseField key)INTERNAL: Retrieve the value for the field.protected DatabaseFieldgetLookupField(java.lang.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 checkjava.lang.ObjectgetSopObject()INTERNAL:java.util.VectorgetValues()INTERNAL:java.lang.ObjectgetValues(java.lang.String key)java.lang.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.java.util.Enumerationkeys()PUBLIC: Returns an Enumeration of the DatabaseField objects.java.util.SetkeySet()PUBLIC: Returns a set of the keys.voidmergeFrom(AbstractRecord row)INTERNAL: Merge the provided row into this row.java.lang.Objectput(java.lang.Object key, java.lang.Object value)PUBLIC: Add the field-value pair to the row.java.lang.Objectput(java.lang.String key, java.lang.Object value)PUBLIC: Add the field-value pair to the row.java.lang.Objectput(DatabaseField key, java.lang.Object value)INTERNAL: Add the field-value pair to the row.voidputAll(java.util.Map map)PUBLIC: Add all of the elements.java.lang.Objectremove(java.lang.Object key)INTERNAL: Remove the field key from the row.java.lang.Objectremove(java.lang.String fieldName)INTERNAL: Remove the field key from the row.java.lang.Objectremove(DatabaseField key)INTERNAL: Remove the field key from the row.voidreplaceAt(java.lang.Object value, int index)INTERNAL: replaces the value at index with valuevoidreplaceAt(java.lang.Object value, DatabaseField key)INTERNAL: replaces the value at field with valueprotected voidresetSize()Reset the row size.protected voidsetFields(java.util.Vector fields)voidsetNullValueInFields(boolean nullValueInFields)INTERNAL: Set the validForUpdateCallCacheCheck attribute to true if the row does not contain nulls, false otherwisevoidsetSopObject(java.lang.Object sopObject)INTERNAL:protected voidsetValues(java.util.Vector values)intsize()PUBLIC: Return the number of field/value pairs in the row.java.lang.StringtoString()INTERNAL:java.util.Collectionvalues()PUBLIC: Returns an collection of the values.
-
-
-
Field Detail
-
fields
protected java.util.Vector<DatabaseField> fields
Use vector to store the fields/values for optimal performance.
-
values
protected java.util.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 java.lang.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(java.util.Vector fields, java.util.Vector values)INTERNAL: converts JDBC results to collections of rows.
-
AbstractRecord
public AbstractRecord(java.util.Vector fields, java.util.Vector values, int size)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, java.lang.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.- Specified by:
clearin interfacejava.util.Map
-
clone
public AbstractRecord clone()
INTERNAL: Clone the row and its values.- Overrides:
clonein classjava.lang.Object
-
contains
public boolean contains(java.lang.Object value)
PUBLIC: Check if the value is contained in the row.
-
containsKey
public boolean containsKey(java.lang.Object key)
PUBLIC: Check if the field is contained in the row. Conform to hashtable interface.- Specified by:
containsKeyin interfacejava.util.Map
-
containsKey
public boolean containsKey(java.lang.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(java.lang.Object value)
PUBLIC: Check if the value is contained in the row.- Specified by:
containsValuein interfacejava.util.Map
-
elements
public java.util.Enumeration elements()
PUBLIC: Returns an Enumeration of the values.
-
entrySet
public java.util.Set entrySet()
PUBLIC: Returns a set of the keys.- Specified by:
entrySetin interfacejava.util.Map
-
get
public java.lang.Object get(java.lang.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.- Specified by:
getin interfacejava.util.Map
-
get
public java.lang.Object get(java.lang.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(java.lang.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 java.lang.Object getIndicatingNoEntry(java.lang.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 java.lang.Object get(DatabaseField key)
INTERNAL: Retrieve the value for the field. If missing null is returned.
-
getValues
public java.lang.Object getValues(DatabaseField key)
-
getValues
public java.lang.Object getValues(java.lang.String key)
-
getIndicatingNoEntry
public java.lang.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 java.util.Vector<DatabaseField> getFields()
INTERNAL:
-
getValues
public java.util.Vector getValues()
INTERNAL:
-
isEmpty
public boolean isEmpty()
PUBLIC: Return if the row is empty.- Specified by:
isEmptyin interfacejava.util.Map
-
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 java.util.Enumeration keys()
PUBLIC: Returns an Enumeration of the DatabaseField objects.
-
keySet
public java.util.Set keySet()
PUBLIC: Returns a set of the keys.- Specified by:
keySetin interfacejava.util.Map
-
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 java.lang.Object put(java.lang.Object key, java.lang.Object value) throws ValidationExceptionPUBLIC: Add the field-value pair to the row.- Specified by:
putin interfacejava.util.Map- Throws:
ValidationException
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)PUBLIC: Add the field-value pair to the row.
-
put
public java.lang.Object put(DatabaseField key, java.lang.Object value)
INTERNAL: Add the field-value pair to the row.
-
putAll
public void putAll(java.util.Map map)
PUBLIC: Add all of the elements.- Specified by:
putAllin interfacejava.util.Map
-
remove
public java.lang.Object remove(java.lang.Object key)
INTERNAL: Remove the field key from the row.- Specified by:
removein interfacejava.util.Map
-
remove
public java.lang.Object remove(java.lang.String fieldName)
INTERNAL: Remove the field key from the row.
-
remove
public java.lang.Object remove(DatabaseField key)
INTERNAL: Remove the field key from the row.
-
replaceAt
public void replaceAt(java.lang.Object value, int index)INTERNAL: replaces the value at index with value
-
replaceAt
public void replaceAt(java.lang.Object value, DatabaseField key)INTERNAL: replaces the value at field with value
-
setFields
protected void setFields(java.util.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(java.util.Vector values)
-
size
public int size()
PUBLIC: Return the number of field/value pairs in the row.- Specified by:
sizein interfacejava.util.Map
-
toString
public java.lang.String toString()
INTERNAL:- Overrides:
toStringin classjava.lang.Object
-
values
public java.util.Collection values()
PUBLIC: Returns an collection of the values.- Specified by:
valuesin interfacejava.util.Map
-
hasSopObject
public boolean hasSopObject()
INTERNAL:
-
getSopObject
public java.lang.Object getSopObject()
INTERNAL:
-
setSopObject
public void setSopObject(java.lang.Object sopObject)
INTERNAL:
-
-