|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.boylesoftware.cb2.DataModel
Parent class for Data Models used by the DAO.
DAO
,
Serialized FormConstructor Summary | |
DataModel()
|
Method Summary | |
java.lang.String[] |
diff(DataModel dm)
Finds fields that have different values in this DM and the specified one, which must belong to the exactly same class. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this data model. |
java.lang.Object |
getField(java.lang.String name)
Gets a field's value by its name. |
int |
hashCode()
Returns hash code of the data model. |
void |
setField(java.lang.String name,
java.lang.Object value)
Sets new value to a field via reflection. |
java.lang.String |
toString()
Gives string representation of the data model including values of all its fields. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DataModel()
Method Detail |
public int hashCode()
toString
method making
two data models equal if they contain the same data.
Note, that this method is not very effective. Its performace greatly depends on the amount of data in the DM, so try to avoid using large DMs in hash-like data structures.
public boolean equals(java.lang.Object obj)
obj
is a
reference to the same instance as this one, then, if it is not so, it
checks if obj
belongs to the exactly same class and if
its string representation is the same.
obj
- data model, to which to compare this one.
true
if obj
equals to this
data model, that is it is not null
, has the same
type and the same string representation.public java.lang.String toString()
Note, that the resulting string generated by this method can be HUGE.
public java.lang.String[] diff(DataModel dm)
This method ignores all array and nested DM fields.
dm
- another DM.
equals
method,
which compares string representations of the DMs that include values
from all nested DMs and arrays of nested DMs).
java.lang.IllegalArgumentException
- if type of the specified DM is
different from the type of this one.public java.lang.Object getField(java.lang.String name) throws java.lang.NoSuchFieldException
name
- name of a DM field.
java.lang.NoSuchFieldException
- if no public field with the specified name
is defined in the DM.public void setField(java.lang.String name, java.lang.Object value) throws java.lang.NoSuchFieldException
set
method of java.lang.reflect.Field
, and
therefore all features of the the set
method apply to
this method as well.
name
- DM field's name.value
- new value.
java.lang.NoSuchFieldException
- if no public field with the specified name
is defined in the DM.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |