public interface FragmentData
In general, FragmentData works as a wrapper around a (generic) Java object
that represents the actual value. This avoids using Object in the API and also
allows to provide helper functionality to access the generic value in a controlled way.
Values are typed. The availability of type is implementation-specific, though a
minimum of data types needs to be supported. For more information about data types and
conversion rules, see DataType.
| Modifier and Type | Method and Description |
|---|---|
String |
getContentType()
Returns the content type for textbased data types.
|
DataType |
getDataType()
Gets the data type of the value.
|
Object |
getValue()
Gets the original value as a generic Java object.
|
<T> T |
getValue(Class<T> type)
Gets the value, converted to the provided type.
|
boolean |
isTypeSupported(Class type)
Checks if the specified Java data type is supported for calls to
getValue(Class) and setValue(Object). |
void |
setContentType(String contentType)
Sets the content type for text-based data types.
|
void |
setValue(Object value)
Sets the value.
|
@Nullable <T> T getValue(Class<T> type)
For information about supported type conversions: see DataType.
Note that this method is supposed to return a suitably converted value for all
types where isTypeSupported(Class) returns true
T - Describes the type parametertype - The type the value should be converted tonull if the value could not be converted to the provided
typeboolean isTypeSupported(Class type)
getValue(Class) and setValue(Object).type - The class object representing the typetrue if the type is supported@Nullable Object getValue()
void setValue(@Nullable Object value) throws ContentFragmentException
The general rule is that a non-null value that was retrieved using
getValue(Class) needs to be accepted and converted to a suitable original
value. Also, every value of a type where isTypeSupported(Class) returns
true needs to be accepted and converted accordingly.
Note that for the value to be persisted,
ContentElement.setValue(FragmentData) or
ContentVariation.setValue(FragmentData) have to be called explicitly.
This allows for manipulating the value multiple times before actually persisting it.
value - The valueContentFragmentException - if the type of the value provided is unsupported@Nullable String getContentType()
This will return a MIME type only when applicable. For numbers, dates, booleans,
it will typically be null.
null if not applicableCopyright © 2006-2017 Adobe Systems Incorporated. All Rights Reserved.