|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.dataset.DataCommand
public abstract class DataCommand
Represents a command that can be executed against a data store by a DataProvider
, for example, commands for retrieving data, or for persisting
data to the data store. For an example of how this is used, see AbstractSqlCommand
. A concrete DataCommand
is assigned to a DataProvider using DataProvider.setCommand(DataCommand)
and retrieved using DataProvider.getCommand()
.
A DataCommand holds a set of named parameters, each of which is assigned a value. These parameters are then used in executing the command.
A DataCommand allows a DataProvider
to provide a harness around load and save
operations, without needing the specifics of interaction with a data store. For
SQL databases, a DataCommand may be a SELECT for reads and an INSERT, UPDATE
or DELETE for writes. The DataProvider doesn't need to know how these SQL statements
are actually built for the table in question--in fact, stored procedures could be
used just by substituting the DataCommand used for reads or writes. Note that this
abstract DataCommand class does not define the semantics of the commands--that must
be done in its subclasses.
Internal--This is a class used internally in this package and is not of general purpose use.
TODO: Appears to be a bug with getParamValues() -- it should only return the values associated with the specified param names. Futher, set/get/clear methods should only work for the specified param names. Alternatively, there should be a default implementation of getParamNames, that returns the keys used in the param map.
The struggle here is that the SQL based DataCommands have a specific set of params -- no more, no less. However, and HTTP based DataCommand can have any number of parameters. It could be a dynamic set.
Constructor Summary | |
---|---|
DataCommand()
|
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
void |
clearParameter(java.lang.String name)
Clears the given named parameter of any associated value. |
void |
clearParameters()
Clears all of the parameters; see clearParameter(String) |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
|
java.lang.Object |
getParameter(java.lang.String name)
Returns the value for the given named parameter. |
abstract java.lang.String[] |
getParameterNames()
Returns an array containing all of the parameter names for this DataCommand |
java.lang.Object[] |
getParameterValues()
Returns an object array containing all of the parameter values for this DataCommand. |
java.lang.String |
getShortDescription()
Returns the short description of this DataCommand |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
void |
setParameter(java.lang.String name,
java.lang.Object value)
Sets the given named parameter to the given value, overwriting any value already assigned. |
void |
setShortDescription(java.lang.String shortDescription)
Set a short description for this Task. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataCommand()
Method Detail |
---|
public void setShortDescription(java.lang.String shortDescription)
public java.lang.String getShortDescription()
public void setParameter(java.lang.String name, java.lang.Object value)
name
- The parameter's namevalue
- The parameter's valuepublic void clearParameter(java.lang.String name)
name
- The named parameter to clear.public void clearParameters()
clearParameter(String)
public java.lang.Object getParameter(java.lang.String name)
name
- The name of the parameter to look up
public abstract java.lang.String[] getParameterNames()
public java.lang.Object[] getParameterValues()
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- listener
- public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |