Class MetaDataProcessorResolver
- java.lang.Object
-
- org.craftercms.core.processors.impl.resolvers.MetaDataProcessorResolver
-
- All Implemented Interfaces:
ItemProcessorResolver
public class MetaDataProcessorResolver extends Object implements ItemProcessorResolver
ItemProcessorResolver
that searches the item's descriptor for a processor element that defines the name of the processor- Author:
- Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,ItemProcessor>
elementValueToProcessorMappings
Mappings of processor element values to processor names.protected String
processorElementXPathQuery
The XPath query for the processor element that defines the processor to use.
-
Constructor Summary
Constructors Constructor Description MetaDataProcessorResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemProcessor
getProcessor(Item item)
Looks for the processor element (by querying it with theprocessorElementXPathQuery
) in the item's descriptor.void
setElementValueToProcessorMappings(Map<String,ItemProcessor> elementValueToProcessorMappings)
Sets the mappings of processor element values to processor names.void
setProcessorElementXPathQuery(String processorElementXPathQuery)
Sets the XPath query for the processor element that defines the processor to use.
-
-
-
Field Detail
-
processorElementXPathQuery
protected String processorElementXPathQuery
The XPath query for the processor element that defines the processor to use.
-
elementValueToProcessorMappings
protected Map<String,ItemProcessor> elementValueToProcessorMappings
Mappings of processor element values to processor names.
-
-
Method Detail
-
setProcessorElementXPathQuery
public void setProcessorElementXPathQuery(String processorElementXPathQuery)
Sets the XPath query for the processor element that defines the processor to use.
-
setElementValueToProcessorMappings
public void setElementValueToProcessorMappings(Map<String,ItemProcessor> elementValueToProcessorMappings)
Sets the mappings of processor element values to processor names.
-
getProcessor
public ItemProcessor getProcessor(Item item) throws XmlException
Looks for the processor element (by querying it with theprocessorElementXPathQuery
) in the item's descriptor. If the element is found, the element value is mapped to a processor and that processor is returned.- Specified by:
getProcessor
in interfaceItemProcessorResolver
- Throws:
XmlException
- if the element value doesn't refer to an existing processor
-
-