|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.boylesoftware.cb2.DataModel com.boylesoftware.cb2.DynamicDataModel
Special implementation of Data Model, which is not associated with any
specific result set, but is able to contain any data in a form of name-value
mappings. A query can be associated with DynamicDataModel
and
then used with a DAO fetch call. The DAO then will return instances of
DynamicDataModel
containing data for all columns in the result
set. The keys in the data model's map will be column labels aquired via
getColumnLabel
call on the JDBC's
ResultSetMetaData
object, and the values - objects returned by
getObject
method on the ResultSet
.
Note, that although it is very tempting to use this class in many cases, it is significantly less efficient than using normal DMs, so it should be done only in very special cases.
This class is not synchronized.
Nested Class Summary |
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Method Summary | |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.lang.String[] |
diff(DataModel dm)
Finds fields that have different values in this DM and the specified one, which must be a DynamicDataModel too. |
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
getField(java.lang.String name)
Gets a field's value by its name. |
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map t)
|
java.lang.Object |
remove(java.lang.Object key)
|
void |
setField(java.lang.String name,
java.lang.Object value)
Sets a field's value by the field's name. |
int |
size()
|
java.lang.String |
toString()
Gives string representation of the data model including values of all its fields |
java.util.Collection |
values()
|
Methods inherited from class com.boylesoftware.cb2.DataModel |
equals, hashCode |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Method Detail |
public java.lang.String toString()
toString
in class DataModel
public java.lang.String[] diff(DataModel dm)
DynamicDataModel
too.
diff
in class DataModel
dm
- another dynamic DM.
java.lang.IllegalArgumentException
- if type of the specified DM is not
DynamicDataModel
.public java.lang.Object getField(java.lang.String name) throws java.lang.NoSuchFieldException
DynamicDataModel
this does almost the same as the
get
method from the java.util.Map
interface
implemented by this class. The difference is that this method throws a
NoSuchFieldException
if the requested field does not exist,
while the get
method simply returns null
.
getField
in class DataModel
name
- name of a DM field.
java.lang.NoSuchFieldException
- if the requested field is not present in
the DM.public void setField(java.lang.String name, java.lang.Object value)
DynamicDataModel
this is a complete analogue of
put
method from the java.util.Map
interface
implemented by this class.
setField
in class DataModel
name
- name of a DM field.value
- new value.public int size()
size
in interface java.util.Map
public void clear()
clear
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public void putAll(java.util.Map t)
putAll
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |