EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

org.eclipse.persistence.sessions
Class DatabaseRecord

java.lang.Object
  extended by org.eclipse.persistence.internal.sessions.AbstractRecord
      extended by org.eclipse.persistence.sessions.DatabaseRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map, Record

public class DatabaseRecord
extends org.eclipse.persistence.internal.sessions.AbstractRecord

Purpose: Define a representation of a database row as field=>value pairs. This is the database row implementation class, the Record or java.util.Map interfaces should be used to access this class instead of the implementation class.

Responsibilities:

See Also:
DatabaseField, Record, Map, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
org.eclipse.persistence.internal.sessions.AbstractRecord.EntrySet, org.eclipse.persistence.internal.sessions.AbstractRecord.KeySet, org.eclipse.persistence.internal.sessions.AbstractRecord.NoEntry, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordEntry, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordEntryIterator, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordKeyIterator, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordValuesIterator, org.eclipse.persistence.internal.sessions.AbstractRecord.ValuesSet
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
fields, lookupField, noEntry, size, values
 
Constructor Summary
DatabaseRecord()
          INTERNAL: Returns a record (of default size).
DatabaseRecord(int initialCapacity)
          INTERNAL: Returns a record of the given initial capacity.
DatabaseRecord(java.util.Vector fields, java.util.Vector values)
          INTERNAL: Builds row from database result fields and values.
 
Method Summary
 void clear()
          PUBLIC: Clears the contents of the database row, both fields and values.
 boolean contains(java.lang.Object value)
          PUBLIC: Checks if the given Object value is contained in the values held in the database row.
 boolean containsKey(java.lang.Object key)
          PUBLIC: Checks if a key (ie. the field) is contained in the database row.
 boolean containsKey(java.lang.String fieldName)
          PUBLIC: Checks if a given field is contained in the database row.
 boolean containsValue(java.lang.Object value)
          PUBLIC: Checks if the given Object value is contained in the values held in the database row.
 java.util.Enumeration elements()
          PUBLIC: Returns an Enumeration of the values in the database row.
 java.util.Set entrySet()
          PUBLIC: Returns a set of map entries (ie. field-value pairs)in the database row with the DatabaseFields as keys and the value Objects as values.
 java.lang.Object get(java.lang.Object key)
          PUBLIC: Retrieves the value for the given key.
 java.lang.Object get(java.lang.String fieldName)
          PUBLIC: Retrieves the value with the given name of the DatabaseField.
 java.lang.Object getIndicatingNoEntry(java.lang.String fieldName)
          PUBLIC: Retrieves the value with the given field name.
 java.lang.Object getValues(org.eclipse.persistence.internal.helper.DatabaseField key)
          PUBLIC: Returns the Object associated with the given key (null if the key does not map to an Object.)
 java.lang.Object getValues(java.lang.String key)
          PUBLIC: Returns the Object associated with the given key (null if the key does not map to an Object.)
 boolean isEmpty()
          PUBLIC: Checks if the database row is empty (ie. there are no field-value pairs.)
 java.util.Enumeration keys()
          PUBLIC: Returns an Enumeration of the DatabaseField Objects.
 java.util.Set keySet()
          PUBLIC: Returns a set of the keys, the DatabaseField Objects, for the database row.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          PUBLIC: Adds a field-value pair to the row.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          PUBLIC: Adds a field-value pair to the row.
 void putAll(java.util.Map map)
          PUBLIC: Adds all of the elements in the given map to the database row.
 int size()
          PUBLIC: Returns the number of field-value pairs in the database row.
 java.util.Collection values()
          PUBLIC: Returns a collection of the values held in the database row.
 
Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
add, clone, containsKey, get, getField, getFields, getIndicatingNoEntry, getValues, mergeFrom, put, remove, remove, remove, replaceAt, resetSize, setFields, setValues, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

DatabaseRecord

public DatabaseRecord()
INTERNAL: Returns a record (of default size).


DatabaseRecord

public DatabaseRecord(int initialCapacity)
INTERNAL: Returns a record of the given initial capacity.

Parameters:
initialCapacity -

DatabaseRecord

public DatabaseRecord(java.util.Vector fields,
                      java.util.Vector values)
INTERNAL: Builds row from database result fields and values. Note: the entire database result will share the same fields vector.

Parameters:
fields - Vector of fields
values - Vector of values
Method Detail

clear

public void clear()
PUBLIC: Clears the contents of the database row, both fields and values.

Specified by:
clear in interface java.util.Map
Overrides:
clear in class org.eclipse.persistence.internal.sessions.AbstractRecord

contains

public boolean contains(java.lang.Object value)
PUBLIC: Checks if the given Object value is contained in the values held in the database row.

Overrides:
contains in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
value - the Object to be considered
Returns:
boolean - true if the Object value is in the row.

containsKey

public boolean containsKey(java.lang.Object key)
PUBLIC: Checks if a key (ie. the field) is contained in the database row. Conforms to a hashtable interface.

Specified by:
containsKey in interface java.util.Map
Overrides:
containsKey in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
key - an Object, either String or DatabaseField
Returns:
boolean - true if the row with the corresponding key is in the row.

containsKey

public boolean containsKey(java.lang.String fieldName)
PUBLIC: Checks if a given field is contained in the database row.

Overrides:
containsKey in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
key - String, the DatabaseField name
Returns:
boolean - true if the row contains the key with the corresponding fieldName.

containsValue

public boolean containsValue(java.lang.Object value)
PUBLIC: Checks if the given Object value is contained in the values held in the database row.

Specified by:
containsValue in interface java.util.Map
Overrides:
containsValue in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
value - the Object under consideration
Returns:
boolean - true if the row contains the Object as a value

elements

public java.util.Enumeration elements()
PUBLIC: Returns an Enumeration of the values in the database row.

Overrides:
elements in class org.eclipse.persistence.internal.sessions.AbstractRecord
Returns:
Enumeration

entrySet

public java.util.Set entrySet()
PUBLIC: Returns a set of map entries (ie. field-value pairs)in the database row with the DatabaseFields as keys and the value Objects as values.

Specified by:
entrySet in interface java.util.Map
Overrides:
entrySet in class org.eclipse.persistence.internal.sessions.AbstractRecord
Returns:
Set - the set of all the field-value entries (see java.util.Map.Entry)
See Also:
Map.entrySet()

get

public java.lang.Object get(java.lang.Object key)
PUBLIC: Retrieves the value for the given key. A field is constructed with the key to check the hash table. If missing, null is returned.

Specified by:
get in interface java.util.Map
Overrides:
get in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
key - Object, either String or DatabaseField
Returns:
Object

get

public java.lang.Object get(java.lang.String fieldName)
PUBLIC: Retrieves the value with the given name of the DatabaseField. A field is constructed on the name to check the hash table. If missing, null is returned.

Overrides:
get in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
fieldName - String, the DatabaseField name
Returns:
Object - the value

getIndicatingNoEntry

public java.lang.Object getIndicatingNoEntry(java.lang.String fieldName)
PUBLIC: Retrieves the value with the given field name. A field is constructed on the name to check the hash table. If missing, DatabaseRow.noEntry is returned.

Overrides:
getIndicatingNoEntry in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
fieldName - String, the DatabaseField name
Returns:
Object - the value

getValues

public java.lang.Object getValues(org.eclipse.persistence.internal.helper.DatabaseField key)
PUBLIC: Returns the Object associated with the given key (null if the key does not map to an Object.)

Overrides:
getValues in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
key - DatabaseField
Returns:
Object - the value associated with the key

getValues

public java.lang.Object getValues(java.lang.String key)
PUBLIC: Returns the Object associated with the given key (null if the key does not map to an Object.)

Overrides:
getValues in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
key - String
Returns:
Object - the value associated with the key

isEmpty

public boolean isEmpty()
PUBLIC: Checks if the database row is empty (ie. there are no field-value pairs.)

Specified by:
isEmpty in interface java.util.Map
Overrides:
isEmpty in class org.eclipse.persistence.internal.sessions.AbstractRecord
Returns:
boolean - true if the database row is empty

keys

public java.util.Enumeration keys()
PUBLIC: Returns an Enumeration of the DatabaseField Objects.

Overrides:
keys in class org.eclipse.persistence.internal.sessions.AbstractRecord
Returns:
Enumeration

keySet

public java.util.Set keySet()
PUBLIC: Returns a set of the keys, the DatabaseField Objects, for the database row.

Specified by:
keySet in interface java.util.Map
Overrides:
keySet in class org.eclipse.persistence.internal.sessions.AbstractRecord
Returns:
Set of the keys

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
                     throws ValidationException
PUBLIC: Adds a field-value pair to the row.

Specified by:
put in interface java.util.Map
Overrides:
put in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
key - Object, either String or DatabaseField
value - Object
Returns:
Object - the previous Object with that key, could be null
Throws:
ValidationException - if inappropriate key is used

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
PUBLIC: Adds a field-value pair to the row.

Overrides:
put in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
key - String
value - Object
Returns:
Object - the previous Object with that key, could be null

putAll

public void putAll(java.util.Map map)
PUBLIC: Adds all of the elements in the given map to the database row.

Specified by:
putAll in interface java.util.Map
Overrides:
putAll in class org.eclipse.persistence.internal.sessions.AbstractRecord
Parameters:
map - Map of all the field-value elements to be added

size

public int size()
PUBLIC: Returns the number of field-value pairs in the database row.

Specified by:
size in interface java.util.Map
Overrides:
size in class org.eclipse.persistence.internal.sessions.AbstractRecord
Returns:
int

values

public java.util.Collection values()
PUBLIC: Returns a collection of the values held in the database row.

Specified by:
values in interface java.util.Map
Overrides:
values in class org.eclipse.persistence.internal.sessions.AbstractRecord
Returns:
Collection of value Objects

EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference