Class ModelLessXMLValuesExtractor
- java.lang.Object
-
- org.ametys.plugins.repository.data.extractor.xml.ModelLessXMLValuesExtractor
-
- All Implemented Interfaces:
ModelLessValuesExtractor
,ValuesExtractor
public class ModelLessXMLValuesExtractor extends Object implements ModelLessValuesExtractor
This class provides methods to extract values from an XML document
-
-
Field Summary
Fields Modifier and Type Field Description protected XMLValuesExtractorAdditionalDataGetter
_additionalDataGetter
The getter that retrieves needed additional data by typesprotected AbstractThreadSafeComponentExtensionPoint<? extends ModelItemType>
_dataTypesExtensionPoint
Extension point providing available data typesprotected Element
_element
The DOM element containing the XML values
-
Constructor Summary
Constructors Constructor Description ModelLessXMLValuesExtractor(Element element, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, AbstractThreadSafeComponentExtensionPoint<? extends ModelItemType> dataTypesExtensionPoint)
Creates a model less XML values extractor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> T
_extractValue(Element currentElement, String relativeDataPath, String prefix)
Extracts the value at the given pathprotected Map<String,Object>
_extractValues(Element currentElement, String prefix)
Extracts all the values in the current element<T> T
extractValue(String dataPath)
Extracts the value at the given pathMap<String,Object>
extractValues()
Extracts all the values
-
-
-
Field Detail
-
_additionalDataGetter
protected XMLValuesExtractorAdditionalDataGetter _additionalDataGetter
The getter that retrieves needed additional data by types
-
_dataTypesExtensionPoint
protected AbstractThreadSafeComponentExtensionPoint<? extends ModelItemType> _dataTypesExtensionPoint
Extension point providing available data types
-
-
Constructor Detail
-
ModelLessXMLValuesExtractor
public ModelLessXMLValuesExtractor(Element element, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, AbstractThreadSafeComponentExtensionPoint<? extends ModelItemType> dataTypesExtensionPoint)
Creates a model less XML values extractor- Parameters:
element
- the DOM element containing the XML valuesadditionalDataGetter
- the getter that retrieves needed additional data by typesdataTypesExtensionPoint
- the extension point providing available data types
-
-
Method Detail
-
extractValues
public Map<String,Object> extractValues() throws Exception
Description copied from interface:ModelLessValuesExtractor
Extracts all the values- Specified by:
extractValues
in interfaceModelLessValuesExtractor
- Returns:
- the values
- Throws:
Exception
- if an error occurs
-
_extractValues
protected Map<String,Object> _extractValues(Element currentElement, String prefix) throws Exception
Extracts all the values in the current element- Parameters:
currentElement
- the current elementprefix
- the path of the item represented by the current element (prefix of all contained items)- Returns:
- the values
- Throws:
Exception
- if an error occurs
-
extractValue
public <T> T extractValue(String dataPath) throws Exception
Description copied from interface:ValuesExtractor
Extracts the value at the given path- Specified by:
extractValue
in interfaceValuesExtractor
- Type Parameters:
T
- type of the value to retrieve- Parameters:
dataPath
- the data path- Returns:
- the value at the given path
- Throws:
Exception
- if an error occurs
-
_extractValue
protected <T> T _extractValue(Element currentElement, String relativeDataPath, String prefix) throws Exception
Extracts the value at the given path- Type Parameters:
T
- type of the value to retrieve- Parameters:
currentElement
- the DOM element containing the items' valuesrelativeDataPath
- The data path relative to the current elementprefix
- the path of the item represented by the current element (prefix of all contained items)- Returns:
- the value
- Throws:
Exception
- if an error occurs
-
-