|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.data.provider.impl.MethodResultDataProvider
public class MethodResultDataProvider
A DataProvider implementation to wrap the singleton (non-array) return
value from a method. Set the dataClassInstance,
dataMethod, and dataMethodArguments properties to
point to a method on a class instance. The result from that method call
will be wrapped as a DataProvider.
| Constructor Summary | |
|---|---|
MethodResultDataProvider()
Constructs a new MethodResultDataProvider with no dataClassInstance or dataMethod specified. |
|
MethodResultDataProvider(java.lang.Object dataClassInstance,
java.lang.reflect.Method dataMethod)
Constructs a new MethodResultDataProvider using the specified dataClassInstance and dataMethod. |
|
| Method Summary | |
|---|---|
void |
addDataListener(DataListener listener)
Register a new |
void |
addRefreshableDataListener(RefreshableDataListener l)
Register a new |
protected void |
fireRefreshed()
Fires a refreshed event to each registered RefreshableDataListener |
java.lang.Object |
getDataClassInstance()
Returns the dataClassInstance that contains the dataMethod to be invoked. |
DataListener[] |
getDataListeners()
|
java.lang.reflect.Method |
getDataMethod()
Returns the currently set dataMethod |
java.lang.Object[] |
getDataMethodArguments()
Returns the dataMethodArguments |
FieldKey |
getFieldKey(java.lang.String fieldId)
Returns the |
FieldKey[] |
getFieldKeys()
|
RefreshableDataListener[] |
getRefreshableDataListeners()
|
java.lang.Object |
getResultObject()
Read-only access to the result object from the invocation of the dataMethod |
java.lang.Class |
getType(FieldKey fieldKey)
Returns the data type of the data element referenced by the specified data key. |
java.lang.Object |
getValue(FieldKey fieldKey)
Returns value of the data element referenced by the specified
|
void |
invokeDataMethod()
Invokes the dataMethod using the arguments specified by the dataMethodArguments property. |
void |
invokeDataMethod(java.lang.Object[] args)
Invokes the dataMethod using the specified arguments. |
boolean |
isIncludeFields()
|
boolean |
isReadOnly(FieldKey fieldKey)
Return a flag indicating whether the value of the data element
represented by the specified |
void |
refresh()
Invokes the dataMethod on the dataClassInstance to refresh the data provider's contets |
protected void |
refreshFieldKeys()
Refreshes the list of available fieldKeys (based on the return type of the dataMethod) |
void |
removeDataListener(DataListener listener)
Deregister an existing |
void |
removeRefreshableDataListener(RefreshableDataListener l)
Deregister an existing |
void |
setDataClassInstance(java.lang.Object instance)
Sets the dataClassInstance that contains the dataMethod to be invoked. |
void |
setDataMethod(java.lang.reflect.Method method)
Sets the dataMethod that will be invoked |
void |
setDataMethodArguments(java.lang.Object[] methodArgs)
Sets the dataMethodArguments, which will be passed to the dataMethod when it is invoked. |
void |
setIncludeFields(boolean includeFields)
Sets the includeFields property. |
void |
setValue(FieldKey fieldKey,
java.lang.Object value)
Set the value of the data element represented by the specified
|
protected void |
testInvokeDataMethod()
Tests to see if the dataMethod has been invoked, and invokes it if it has not. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MethodResultDataProvider()
public MethodResultDataProvider(java.lang.Object dataClassInstance,
java.lang.reflect.Method dataMethod)
dataClassInstance - The class instance where the method is invokeddataMethod - The method where the data is from| Method Detail |
|---|
public java.lang.Object getDataClassInstance()
public void setDataClassInstance(java.lang.Object instance)
instance - Objectpublic java.lang.reflect.Method getDataMethod()
public void setDataMethod(java.lang.reflect.Method method)
method - Method
public java.lang.Object getResultObject()
throws DataProviderException
DataProviderExceptionpublic void setIncludeFields(boolean includeFields)
Sets the includeFields property. This affects the set of FieldKeys that this DataProvider emits.
If includeFields is set to true (the default), then public fields will
be included in the list of available keys (intermixed with the public
properties). If it is set to false, then only the public properties
will be available.
includeFields - true to include the public fields, or
false to exclude them (and only show public
properties)public boolean isIncludeFields()
protected void refreshFieldKeys()
public void setDataMethodArguments(java.lang.Object[] methodArgs)
methodArgs - Object[]public java.lang.Object[] getDataMethodArguments()
public void invokeDataMethod()
throws DataProviderException
DataProviderException
public void invokeDataMethod(java.lang.Object[] args)
throws DataProviderException
args - Object[]
DataProviderException
protected void testInvokeDataMethod()
throws DataProviderException
DataProviderException
public void refresh()
throws DataProviderException
refresh in interface RefreshableDataProviderDataProviderException - Implementations may wish to surface
internal exceptions (nested in DataProviderException). Consult
the documentation of the specific DataProvider implementation for
details on what exceptions might be wrapped by a DPE.public void addRefreshableDataListener(RefreshableDataListener l)
Register a new RefreshableDataListener to this
RefreshableDataProvider instance.
addRefreshableDataListener in interface RefreshableDataProviderl - New RefreshableDataListener to registerpublic void removeRefreshableDataListener(RefreshableDataListener l)
Deregister an existing RefreshableDataListener from
RefreshableDataProvider instance.
removeRefreshableDataListener in interface RefreshableDataProviderl - Old RefreshableDataListener to removepublic RefreshableDataListener[] getRefreshableDataListeners()
getRefreshableDataListeners in interface RefreshableDataProviderRefreshableDataListeners
currently registered on this RefreshableDataProvider.
If there are no registered listeners, a zero-length array is
returned.protected void fireRefreshed()
RefreshableDataListener
RefreshableDataListener.refreshed(RefreshableDataProvider)
public FieldKey[] getFieldKeys()
throws DataProviderException
getFieldKeys in interface DataProviderFieldKeys supported by this
DataProvider. If the set of valid FieldKeys cannot
be determined, return null instead.
DataProviderException - Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null or an empty array. Consult the
documentation of the specific DataProvider implementation for
details on what exceptions might be wrapped by a DPE.
public FieldKey getFieldKey(java.lang.String fieldId)
throws DataProviderException
Returns the FieldKey associated with the specified data
element canonical id, if any; otherwise, return null.
getFieldKey in interface DataProviderfieldId - Canonical id of the requested FieldKey
FieldKey associated with the specified data
element canonical id, if any; otherwise, return
null
DataProviderException - Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. A DPE may also indicate that the
passed fieldId is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.
public java.lang.Class getType(FieldKey fieldKey)
throws DataProviderException
Returns the data type of the data element referenced by the specified data key.
getType in interface DataProviderfieldKey - FieldKey identifying the data element
whose type is to be returned
DataProviderException - Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. A DPE may also indicate that the
passed fieldKey is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.
public java.lang.Object getValue(FieldKey fieldKey)
throws DataProviderException
Returns value of the data element referenced by the specified
FieldKey.
getValue in interface DataProviderfieldKey - FieldKey identifying the data element
whose value is to be returned
FieldKey
DataProviderException - Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. A DPE may also indicate that the
passed fieldKey is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.
public boolean isReadOnly(FieldKey fieldKey)
throws DataProviderException
Return a flag indicating whether the value of the data element
represented by the specified FieldKey can be modified via the
setValue() method.
isReadOnly in interface DataProviderfieldKey - FieldKey identifying the data element
whose settable status is to be returned
FieldKey can be modified
via the setValue() method
DataProviderException - Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning true. A DPE may also indicate that the
passed fieldKey is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.
public void setValue(FieldKey fieldKey,
java.lang.Object value)
throws DataProviderException
Set the value of the data element represented by the specified
FieldKey to the specified new value.
setValue in interface DataProviderfieldKey - FieldKey identifying the data element
whose value is to be modifiedvalue - New value for this data element
DataProviderException - Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. A DPE may also indicate that the
passed fieldKey is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.public void addDataListener(DataListener listener)
Register a new DataListener to this DataProvider
instance.
addDataListener in interface DataProviderlistener - New DataListener to registerpublic void removeDataListener(DataListener listener)
Deregister an existing DataListener from this
DataProvider instance.
removeDataListener in interface DataProviderlistener - Old DataListener to deregisterpublic DataListener[] getDataListeners()
getDataListeners in interface DataProviderDataListeners currently
registered on this DataProvider. If there are no registered
listeners, a zero-length array is returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||