EclipseLink 1.0_1.0M2 API Reference - Incubation

org.eclipse.persistence.sessions
Class DatabaseRecord

java.lang.Object
  extended by AbstractRecord
      extended by org.eclipse.persistence.sessions.DatabaseRecord

public class DatabaseRecord
extends 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 implemention class.

Responsibilities:

See Also:
DatabaseField, Record, Map

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(DatabaseField 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.


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.

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.

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.

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.

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.

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.

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.

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.

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.

Parameters:
fieldName - String, the DatabaseField name
Returns:
Object - the value

getValues

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

Parameters:
key - DatabaseField
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.)

Returns:
boolean - true if the database row is empty

keys

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

Returns:
Enumeration

keySet

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

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.

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.

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.

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.

Returns:
int

values

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

Returns:
Collection of value Objects

EclipseLink 1.0_1.0M2 API Reference - Incubation