|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.data.provider.impl.AbstractDataProvider
com.sun.data.provider.impl.ObjectDataProvider
public class ObjectDataProvider
This DataProvider
wraps access to a single
Java Object. The FieldKey
s correspond to the JavaBean properties and
optionally the public member fields of the Java Object.
NOTE about Serializable: This class wraps access to any Java Object. The
Object can be swapped out using the setObject(Object)
method.
For this class to remain Serializable, the contained Object must also be
Serializable.
Field Summary |
---|
Fields inherited from class com.sun.data.provider.impl.AbstractDataProvider |
---|
dpListeners, fieldKeys |
Constructor Summary | |
---|---|
ObjectDataProvider()
Constructs a new ObjectDataProvider with default settings, and no contained Object. |
|
ObjectDataProvider(java.lang.Object object)
Constructs a new ObjectDataProvider to wrap the specified Object. |
|
ObjectDataProvider(java.lang.Object object,
boolean includeFields)
Creates a new ObjectDataProvider to wrap the specified Object. |
Method Summary | |
---|---|
FieldKey |
getFieldKey(java.lang.String fieldId)
Returns the |
FieldKey[] |
getFieldKeys()
|
java.lang.Object |
getObject()
|
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
|
boolean |
isIncludeFields()
|
boolean |
isReadOnly(FieldKey fieldKey)
Return a flag indicating whether the value of the data element
represented by the specified |
void |
setIncludeFields(boolean includeFields)
Sets the includeFields property. |
void |
setObject(java.lang.Object object)
Sets the Object to be wrapped by this DataProvider. |
void |
setValue(FieldKey fieldKey,
java.lang.Object value)
Set the value of the data element represented by the specified
|
Methods inherited from class com.sun.data.provider.impl.AbstractDataProvider |
---|
addDataListener, addFieldKey, addFieldKeys, clearFieldKeys, fireProviderChanged, fireValueChanged, getDataListeners, getFakeData, getFakeData, getType, getValue, isReadOnly, removeDataListener, removeFieldKey, removeFieldKeys, setValue, sortFieldKeys |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectDataProvider()
public ObjectDataProvider(java.lang.Object object)
object
- The Object to wrap as a DataProviderpublic ObjectDataProvider(java.lang.Object object, boolean includeFields)
object
- The Object to wrap as a DataProviderincludeFields
- true to include the public fields, false to only
surface the public properties as FieldKeys.Method Detail |
---|
public java.lang.Object getObject()
public void setObject(java.lang.Object object)
object
- The Object to be wrapped by this DataProviderpublic boolean isIncludeFields()
public void setIncludeFields(boolean includeFields)
Sets the includeFields property. This affects the set of FieldKey
s 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 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 DataProvider
getFieldKey
in class AbstractDataProvider
fieldId
- 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 FieldKey[] getFieldKeys() throws DataProviderException
getFieldKeys
in interface DataProvider
getFieldKeys
in class AbstractDataProvider
FieldKey
s supported by this
DataProvider
. If the set of valid FieldKey
s 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 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 DataProvider
getType
in class AbstractDataProvider
fieldKey
- 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 DataProvider
getValue
in class AbstractDataProvider
fieldKey
- 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 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 DataProvider
setValue
in class AbstractDataProvider
fieldKey
- 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 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 DataProvider
isReadOnly
in class AbstractDataProvider
fieldKey
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |