|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.mgmt.EntityImpl
com.antelmann.sql.RowItem
public class RowItem
represents a row in a sql database table and provides convenient access to its properties.
It is suggested to have special derived RowItem classes to handle
special mappings.
To customize the way the columns are accessed vs. how they are stored,
consider overriding getProperty() and setProperty()
to convert e.g. from java.util.Date to java.sql.Timestamp and vice versa.
Also, you may want to override checkPropertyChange to restrict
the type for certain columns.
To support the dirty tag, the ChangeListenerSupport is enabled for RowItems
by default.
| Field Summary |
|---|
| Fields inherited from class com.antelmann.mgmt.EntityImpl |
|---|
propertyChangeSupport, props |
| Constructor Summary | |
|---|---|
RowItem(String tableName,
String idColumn,
Object id,
Map<String,Object> props,
String... columns)
|
|
RowItem(String tableName,
String idColumn,
Object id,
String... columns)
constructs a RowItem with empty properties and the given columns |
|
| Method Summary | |
|---|---|
protected void |
checkPropertyChange(String key,
Object value)
allows only keys that correspond to an existing column, unless there are no columns present, in which case true is always returned. |
boolean |
equals(Object obj)
columns (other than the idColumn) are ignored |
Map<String,Object> |
getColumnProperties()
extracts only those properties that corresponds to a column of this instance |
String[] |
getColumns()
returns all columns of the table other than the idColumn |
String |
getIdColumn()
returns the field name for accessing the primary key (whoms value can be accessed by getID(). |
String |
getTableName()
|
boolean |
isDirty()
the dirty flag is automatically set to true on each property change if the ChangeListenerSupport remains enabled |
boolean |
sameTable(RowItem row)
checks for table, idColumn and columns to be identical |
void |
setColumns(String[] columns)
allows to set the available columns in the table belonging to this row. |
void |
setDirty(boolean flag)
|
String |
toString()
|
| Methods inherited from class com.antelmann.mgmt.EntityImpl |
|---|
addPropertyChangeListener, containsPropertyText, enableChangeListenerSupport, equalWithProperties, getID, getProperties, getProperty, getPropertyChangeListeners, hashCode, isChangeListenerSupportEnabled, removeProperty, removePropertyChangeListener, setAll, setProperty, verifyProperties |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RowItem(String tableName,
String idColumn,
Object id,
String... columns)
public RowItem(String tableName,
String idColumn,
Object id,
Map<String,Object> props,
String... columns)
| Method Detail |
|---|
protected void checkPropertyChange(String key,
Object value)
throws IllegalArgumentException
checkPropertyChange in class EntityImplIllegalArgumentException - if the change of the value is not to be allowedEntityImpl.setProperty(String, Object),
EntityImpl.removeProperty(String)public boolean isDirty()
public void setDirty(boolean flag)
public String getTableName()
public String getIdColumn()
getID().
public String[] getColumns()
public boolean sameTable(RowItem row)
public void setColumns(String[] columns)
throws NullPointerException
NullPointerExceptionpublic boolean equals(Object obj)
equals in class EntityImplpublic Map<String,Object> getColumnProperties()
public String toString()
toString in class Object
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||