public interface ModelAwareDataHolder extends DataHolder
Modifier and Type | Method and Description |
---|---|
ModelAwareComposite |
getComposite(String compositePath)
Retrieves the composite at the given path
|
ModelAwareRepeater |
getRepeater(String repeaterPath)
Retrieves the repeater at the given path
|
ModelItemType |
getType(String path)
Retrieves the type of the data at the given path
|
<T> T |
getValue(String dataPath)
Retrieves the value of the data at the given path
|
<T> T |
getValue(String dataPath,
boolean useDefaultFromModel,
T defaultValue)
Retrieves the value of the data at the given path, or the default value
|
boolean |
hasValue(String dataPath)
Checks if there is a value for the data at the given path
|
boolean |
isMultiple(String path)
Checks if the definition of the element at the given path is multiple
|
default void |
toSAX(ContentHandler contentHandler)
Generates SAX events for current
DataHolder |
default void |
toSAX(ContentHandler contentHandler,
Locale locale)
Generates SAX events for the current
DataHolder |
copyTo, dataToSAX, dataToSAX, dataToSAX, dataToSAX, getDataNames
ModelAwareComposite getComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
getComposite
in interface DataHolder
compositePath
- path of the composite to retrievenull
if not existsUndefinedItemPathException
- if the given composite path is not defined by the modelBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multipleIllegalArgumentException
- if the given composite path is null or emptyBadItemTypeException
- if the value stored in the repository at the given path is not a compositeModelAwareRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
getRepeater
in interface DataHolder
repeaterPath
- path of the repeater to retrievenull
if not existsUndefinedItemPathException
- if the given repeater path is not defined by the modelBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multipleIllegalArgumentException
- if the given repeater path is null or emptyBadItemTypeException
- if the value stored in the repository at the given path is not a repeaterboolean hasValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
hasValue
in interface DataHolder
dataPath
- path of the datatrue
if there is value for the data, false
otherwiseBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multipleIllegalArgumentException
- if the given data path is null or empty<T> T getValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
T
- type of the value to retrievedataPath
- path of the datanull
if not exists. The object returned may be of a generic class defined by the storage (if the model is unknown). For example, an url may be returned as a String.IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- if the given data path is not defined by the modelBadItemTypeException
- if the type defined by the model doesn't match the value stored in the repositoryBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple<T> T getValue(String dataPath, boolean useDefaultFromModel, T defaultValue) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
T
- type of the value to retrievedataPath
- path of the datauseDefaultFromModel
- true to use the default value from the model, false to use the given default valuedefaultValue
- default value used if value is null and useDefaultFromModel is false, or if there is no default value on modelnull
if not exists.IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- if the given data path is not defined by the modelBadItemTypeException
- if the type defined by the model doesn't match the value stored in the repositoryBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multipleboolean isMultiple(String path) throws IllegalArgumentException, UndefinedItemPathException
path
- path of the element. No matter if it is a definition or data path (with repeater entry positions)true
if the element is multiple, false
otherwiseIllegalArgumentException
- if the given path is null or emptyUndefinedItemPathException
- if the given path is not defined by the modelModelItemType getType(String path) throws IllegalArgumentException, UndefinedItemPathException
path
- path of the data. No matter if it is a definition or data path (with repeater entry positions)IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- if the given data path is not defined by the modeldefault void toSAX(ContentHandler contentHandler) throws SAXException, UndefinedItemPathException, BadItemTypeException
DataHolder
toSAX
in interface DataHolder
contentHandler
- the ContentHandler
that will receive the SAX eventsUndefinedItemPathException
- if the saxed value's path is not defined by the modelBadItemTypeException
- if the saxed value's type does not matches the stored dataSAXException
- if an error occurs during the SAX events generationdefault void toSAX(ContentHandler contentHandler, Locale locale) throws SAXException, UndefinedItemPathException, BadItemTypeException
DataHolder
toSAX
in interface DataHolder
contentHandler
- the ContentHandler
that will receive the SAX eventslocale
- The locale to use for localized data, such as MultilingualString
. Can be null
to generate SAX events for all existing Locale
s.UndefinedItemPathException
- if the saxed value's path is not defined by the modelBadItemTypeException
- if the saxed value's type does not matches the stored dataSAXException
- if an error occurs during the SAX events generation