public class DefaultModelLessDataHolder extends Object implements ModelLessDataHolder
| Modifier and Type | Field and Description |
|---|---|
protected RepositoryData |
_repositoryData
Repository data to use to store data in the repository
|
protected AbstractThreadSafeComponentExtensionPoint<RepositoryModelItemType> |
_typeExtensionPoint
Extension point to use to get available element types
|
| Constructor and Description |
|---|
DefaultModelLessDataHolder(AbstractThreadSafeComponentExtensionPoint<RepositoryModelItemType> typeExtensionPoint,
RepositoryData repositoryData)
Creates a default model free data holder
|
| Modifier and Type | Method and Description |
|---|---|
protected ModelLessComposite |
_getComposite(String name)
Retrieves the composite with the given name
|
protected ModelLessDataHolder |
_getParentValue(String dataPath)
Retrieves the data holder, last parent segment of the given data path
Example : call this method with a path like 'my-composite/my-repeater[1]/my-data' will retrieve the first repeater entry of the repeater 'my-repeater' in the composite 'my-composite'
|
protected ModelLessRepeater |
_getRepeater(String name)
Retrieves the repeater with the given name
|
private ModelItemType |
_getType(String dataName) |
ModelLessComposite |
getComposite(String compositePath)
Retrieves the composite at the given path
|
Collection<String> |
getDataNames()
Retrieves the names of data contained by this data holder
|
ModelLessRepeater |
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
The type of the value will be deduced from the stored data.
|
<T> T |
getValue(String dataPath,
T defaultValue)
Retrieves the value of the data at the given path, or the default value
|
<T> T |
getValueOfType(String dataPath,
String dataTypeId)
Retrieves the value of the data at the given path
|
<T> T |
getValueOfType(String dataPath,
String dataTypeId,
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 dataPath)
Checks if the value of the data at the given path is multiple
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoSAX, toSAXprotected AbstractThreadSafeComponentExtensionPoint<RepositoryModelItemType> _typeExtensionPoint
protected RepositoryData _repositoryData
public DefaultModelLessDataHolder(AbstractThreadSafeComponentExtensionPoint<RepositoryModelItemType> typeExtensionPoint, RepositoryData repositoryData)
typeExtensionPoint - the extension point to use to get available element typesrepositoryData - the repository data to usepublic ModelLessComposite getComposite(String compositePath) throws IllegalArgumentException, BadItemTypeException
ModelLessDataHoldergetComposite in interface DataHoldergetComposite in interface ModelLessDataHoldercompositePath - path of the composite to retrievenull if not existsIllegalArgumentException - if the given composite path is null or emptyBadItemTypeException - if the value stored in the repository at the given path is not a compositepublic ModelLessRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, BadItemTypeException
ModelLessDataHoldergetRepeater in interface DataHoldergetRepeater in interface ModelLessDataHolderrepeaterPath - path of the repeater to retrievenull if not existsIllegalArgumentException - if the given repeater path is null or emptyBadItemTypeException - if the value stored in the repository at the given path is not a repeaterpublic <T> T getValue(String dataPath) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException
ModelLessDataHoldergetValue in interface ModelLessDataHolderT - type of the value to retrieve. Should match the given data typedataPath - path of the datanull if not exists. The object returned may be of a generic class defined by the storage. For example, an url may be returned as a String. Use the 2 arguments version to ensure to get the right kind of Object.IllegalArgumentException - if the given data path is null or emptyUnknownTypeException - if there is no compatible type with the data at the given data pathNotUniqueTypeException - if there are many compatible types (there is no way to determine which type is the good one)public <T> T getValue(String dataPath, T defaultValue) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException
ModelLessDataHoldergetValue in interface ModelLessDataHolderT - type of the value to retrieve. Should match the given data typedataPath - path of the datadefaultValue - default valueIllegalArgumentException - if the given data path is null or emptyUnknownTypeException - if there is no compatible type with the data at the given data pathNotUniqueTypeException - if there are many compatible types (there is no way to determine which type is the good one)public <T> T getValueOfType(String dataPath, String dataTypeId, T defaultValue) throws IllegalArgumentException, BadItemTypeException
ModelLessDataHoldergetValueOfType in interface ModelLessDataHolderT - type of the value to retrieve. Should match the given data typedataPath - path of the datadataTypeId - type identifier of the datadefaultValue - default valueIllegalArgumentException - if the given data path is null or emptyBadItemTypeException - if the given type doesn't match the type of the value stored in the repository at the given pathpublic <T> T getValueOfType(String dataPath, String dataTypeId) throws IllegalArgumentException, BadItemTypeException
ModelLessDataHoldergetValueOfType in interface ModelLessDataHolderT - type of the value to retrieve. Should match the given data typedataPath - path of the datadataTypeId - type identifier of the datanull if not existsIllegalArgumentException - if the given data path is null or emptyBadItemTypeException - if the given type doesn't match the type of the value stored in the repository at the given pathprotected ModelLessComposite _getComposite(String name) throws BadItemTypeException
name - name of the composite to retrieveBadItemTypeException - if the value stored in the repository with the given name is not a compositeprotected ModelLessRepeater _getRepeater(String name) throws BadItemTypeException
name - name of the repeater to retrieveBadItemTypeException - if the value stored in the repository with the given name is not a repeaterpublic boolean hasValue(String dataPath) throws IllegalArgumentException
ModelLessDataHolderhasValue in interface DataHolderhasValue in interface ModelLessDataHolderdataPath - path of the datatrue if there is value for the data, false otherwiseIllegalArgumentException - if the given data path is null or emptypublic boolean isMultiple(String dataPath) throws IllegalArgumentException, UnknownDataException
ModelLessDataHolderisMultiple in interface ModelLessDataHolderdataPath - path of the data to checktrue if the value of the data is multiple, false otherwiseIllegalArgumentException - if the given data path is null or emptyUnknownDataException - the data at the given path does not existpublic ModelItemType getType(String dataPath) throws IllegalArgumentException, UnknownTypeException, UnknownDataException, NotUniqueTypeException
ModelLessDataHoldergetType in interface ModelLessDataHolderdataPath - path of the dataIllegalArgumentException - if the given data path is null or emptyUnknownTypeException - if there is no compatible type with the data at the given data path or if the data is a repeater entry but the composite type is not availableUnknownDataException - if there is no data in the repository at the given pathNotUniqueTypeException - if there are many compatible types (there is no way to determine which type is the good one)private ModelItemType _getType(String dataName) throws UnknownTypeException, UnknownDataException, NotUniqueTypeException
protected ModelLessDataHolder _getParentValue(String dataPath)
dataPath - the data pathpublic Collection<String> getDataNames()
DataHoldergetDataNames in interface DataHolder