public class ModelAwareRepeaterEntry extends AbstractRepeaterEntry implements ModelAwareDataHolder
Modifier and Type | Field and Description |
---|---|
protected ModelAwareDataHolder |
_defaultDataHolder
the default implementation of a
ModelAwareDataHolder to use |
_modifiableRepositoryData
_repositoryData
Constructor and Description |
---|
ModelAwareRepeaterEntry(RepositoryData repositoryData,
ModelItemGroup definition)
Creates a model aware repeater entry
|
Modifier and Type | Method and Description |
---|---|
void |
copyTo(ModifiableDataHolder dataHolder)
Copies the current
DataHolder to the given ModifiableModelAwareDataHolder . |
ModelAwareComposite |
getComposite(String compositePath)
Retrieves the composite at the given path
|
protected ModelAwareDataHolder |
getDefaultDataHolder()
Retrieves the default implementation of a
DataHolder to use |
ModelAwareRepeater |
getRepeater(String repeaterPath)
Retrieves the repeater at the given path
|
ModelItemType |
getType(String dataPath)
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 |
isMultiple(String path)
Checks if the definition of the element at the given path is multiple
|
getPosition, setPosition
getDataNames, hasValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasValue, toSAX, toSAX
dataToSAX, dataToSAX, dataToSAX, dataToSAX, getDataNames
protected ModelAwareDataHolder _defaultDataHolder
ModelAwareDataHolder
to usepublic ModelAwareRepeaterEntry(RepositoryData repositoryData, ModelItemGroup definition)
repositoryData
- the repository data of the repeater entrydefinition
- the definition of the repeaterpublic ModelAwareComposite getComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
ModelAwareDataHolder
getComposite
in interface DataHolder
getComposite
in interface ModelAwareDataHolder
compositePath
- path of the composite to retrievenull
if not existsIllegalArgumentException
- if the given composite path is null or emptyUndefinedItemPathException
- if the given composite path is not defined by the modelBadItemTypeException
- if the value stored in the repository at the given path is not a compositeBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiplepublic ModelAwareRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
ModelAwareDataHolder
getRepeater
in interface DataHolder
getRepeater
in interface ModelAwareDataHolder
repeaterPath
- path of the repeater to retrievenull
if not existsIllegalArgumentException
- if the given repeater path is null or emptyUndefinedItemPathException
- if the given repeater path is not defined by the modelBadItemTypeException
- if the value stored in the repository at the given path is not a repeaterBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiplepublic <T> T getValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
ModelAwareDataHolder
getValue
in interface ModelAwareDataHolder
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 multiplepublic <T> T getValue(String dataPath, boolean useDefaultFromModel, T defaultValue) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
ModelAwareDataHolder
getValue
in interface ModelAwareDataHolder
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 multiplepublic boolean isMultiple(String path) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException
ModelAwareDataHolder
isMultiple
in interface ModelAwareDataHolder
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 modelBadItemTypeException
public ModelItemType getType(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException
ModelAwareDataHolder
getType
in interface ModelAwareDataHolder
dataPath
- 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 modelBadItemTypeException
public void copyTo(ModifiableDataHolder dataHolder) throws UndefinedItemPathException, BadItemTypeException, UnknownTypeException, NotUniqueTypeException
DataHolder
DataHolder
to the given ModifiableModelAwareDataHolder
.copyTo
in interface DataHolder
dataHolder
- The destination dataHolder. Can not be null.UndefinedItemPathException
- if one of the copied data is not defined by the model of the destination ModifiableModelAwareDataHolder
BadItemTypeException
- if the type defined by the model of the destination ModifiableModelAwareDataHolder
doesn't match the copied valueUnknownTypeException
- if there is no available type compatible with the copied value for the type extension point of the destination ModifiableModelLessDataHolder
NotUniqueTypeException
- if there is more than one available types compatibles with the copied value for the type extension point of the destination ModifiableModelLessDataHolder
protected ModelAwareDataHolder getDefaultDataHolder()
AbstractComposite
DataHolder
to usegetDefaultDataHolder
in class AbstractComposite
DataHolder