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:
DatabaseField
,
Record
,
Map
,
Serialized FormAbstractRecord.NoEntry
fields, lookupField, noEntry, values
Constructor and Description |
---|
DatabaseRecord()
INTERNAL:
Returns a record (of default size).
|
DatabaseRecord(int initialCapacity)
INTERNAL:
Returns a record of the given initial capacity.
|
DatabaseRecord(Vector fields,
Vector values)
INTERNAL:
Builds row from database result fields and values.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
PUBLIC:
Clears the contents of the database row, both fields and values.
|
boolean |
contains(Object value)
PUBLIC:
Checks if the given Object value is contained in the values held
in the database row.
|
boolean |
containsKey(Object key)
PUBLIC:
Checks if a key (ie.
|
boolean |
containsKey(String fieldName)
PUBLIC:
Checks if a given field is contained in the database row.
|
boolean |
containsValue(Object value)
PUBLIC:
Checks if the given Object value is contained in the values held
in the database row.
|
Enumeration |
elements()
PUBLIC:
Returns an Enumeration of the values in the database row.
|
Set |
entrySet()
PUBLIC:
Returns a set of map entries (ie.
|
Object |
get(Object key)
PUBLIC:
Retrieves the value for the given key.
|
Object |
get(String fieldName)
PUBLIC:
Retrieves the value with the given name of the DatabaseField.
|
Object |
getIndicatingNoEntry(String fieldName)
PUBLIC:
Retrieves the value with the given field name.
|
Object |
getValues(DatabaseField key)
PUBLIC:
Returns the Object associated with the given key
(null if the key does not map to an Object.)
|
Object |
getValues(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.
|
Enumeration |
keys()
PUBLIC:
Returns an Enumeration of the DatabaseField Objects.
|
Set |
keySet()
PUBLIC:
Returns a set of the keys, the DatabaseField Objects, for the database row.
|
Object |
put(Object key,
Object value)
PUBLIC:
Adds a field-value pair to the row.
|
Object |
put(String key,
Object value)
PUBLIC:
Adds a field-value pair to the row.
|
void |
putAll(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.
|
Collection |
values()
PUBLIC:
Returns a collection of the values held in the database row.
|
add, clone, containsKey, get, getField, getFields, getIndicatingNoEntry, getValues, mergeFrom, put, remove, remove, remove, replaceAt, setFields, setValues, toString
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public DatabaseRecord()
public DatabaseRecord(int initialCapacity)
initialCapacity
- public void clear()
clear
in interface Map
clear
in class AbstractRecord
public boolean contains(Object value)
contains
in class AbstractRecord
value
- the Object to be consideredpublic boolean containsKey(Object key)
containsKey
in interface Map
containsKey
in class AbstractRecord
key
- an Object, either String or DatabaseFieldpublic boolean containsKey(String fieldName)
containsKey
in class AbstractRecord
key
- String, the DatabaseField namepublic boolean containsValue(Object value)
containsValue
in interface Map
containsValue
in class AbstractRecord
value
- the Object under considerationpublic Enumeration elements()
elements
in class AbstractRecord
public Set entrySet()
entrySet
in interface Map
entrySet
in class AbstractRecord
Map.entrySet()
public Object get(Object key)
get
in interface Map
get
in class AbstractRecord
key
- Object, either String or DatabaseFieldpublic Object get(String fieldName)
get
in class AbstractRecord
fieldName
- String, the DatabaseField namepublic Object getIndicatingNoEntry(String fieldName)
getIndicatingNoEntry
in class AbstractRecord
fieldName
- String, the DatabaseField namepublic Object getValues(DatabaseField key)
getValues
in class AbstractRecord
key
- DatabaseFieldpublic Object getValues(String key)
getValues
in class AbstractRecord
key
- Stringpublic boolean isEmpty()
isEmpty
in interface Map
isEmpty
in class AbstractRecord
public Enumeration keys()
keys
in class AbstractRecord
public Set keySet()
keySet
in interface Map
keySet
in class AbstractRecord
public Object put(Object key, Object value) throws ValidationException
put
in interface Map
put
in class AbstractRecord
key
- Object, either String or DatabaseFieldvalue
- ObjectValidationException
- if inappropriate key is usedpublic Object put(String key, Object value)
put
in class AbstractRecord
key
- Stringvalue
- Objectpublic void putAll(Map map)
putAll
in interface Map
putAll
in class AbstractRecord
map
- Map of all the field-value elements to be addedpublic int size()
size
in interface Map
size
in class AbstractRecord
public Collection values()
values
in interface Map
values
in class AbstractRecord
Copyright © 2024. All rights reserved.