Package de.hybris.bootstrap.xml
Class SimpleValueTagListener
- java.lang.Object
-
- de.hybris.bootstrap.xml.DefaultTagListener
-
- de.hybris.bootstrap.xml.SimpleValueTagListener
-
- All Implemented Interfaces:
TagListener
- Direct Known Subclasses:
BooleanValueTagListener,ClassValueTagListener,DateTagListener,DoubleValueTagListener,IntegerValueTagListener,StringValueTagListener
public abstract class SimpleValueTagListener extends DefaultTagListener
Base class for simple value tags. This class translates either the character content or the content of a specified value attriute. The returned value is either the translated value or a map which maps the content of a specified mapping attribute to the translated value.Some examples:
<foo> value </foo> ... would translate into plain 'value', no value attribute or mapping attribute must be defined <foo bar="value"/> ... would translate into 'value' if 'bar' is specified value attribute <foo key="k1" bar="value"/> ... would translate into { 'k1'=>'value'} if 'bar' is specified value attribute and 'key' the specified mapping attribute
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringUNSPECIFIED_TYPE
-
Constructor Summary
Constructors Constructor Description SimpleValueTagListener(TagListener parent, java.lang.String tagName)SimpleValueTagListener(TagListener parent, java.lang.String tagName, java.lang.String valueAttribute, java.lang.String mappingAttribute)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCharacters()Superclass method overridden to get characters from value attribute if such is specified.java.lang.StringgetTagName()The tag name which this listener is bound to.abstract java.lang.ObjectgetValue()Translation method.booleanisMapped()java.lang.ObjectprocessEndElement(ObjectProcessor processor)To be overridden.-
Methods inherited from class de.hybris.bootstrap.xml.DefaultTagListener
addResult, addSubTagListener, addSubTagValue, characters, clearValues, createSubTagListeners, endElement, getAttribute, getEndLineNumber, getParent, getParents, getPartentTags, getResult, getStartLineNumber, getSubListenerMap, getSubTagDoubleValue, getSubTagIntValue, getSubTagListener, getSubTagValue, getSubTagValueCollection, getSubTagValueMap, isRoot, processError, processStartElement, readAttributes, setEndLineNumber, setStartLineNumber, startElement
-
-
-
-
Field Detail
-
UNSPECIFIED_TYPE
public static final java.lang.String UNSPECIFIED_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SimpleValueTagListener
public SimpleValueTagListener(TagListener parent, java.lang.String tagName)
- Parameters:
parent- the parent tag listenertagName- the tag name which this listener is bound to
-
SimpleValueTagListener
public SimpleValueTagListener(TagListener parent, java.lang.String tagName, java.lang.String valueAttribute, java.lang.String mappingAttribute)
- Parameters:
parent- the parent tag listenertagName- the tag name this listener is bound tovalueAttribute- the xml attribute which contains the value to translate (optional)mappingAttribute- the xml attribute name which contains the key for the translated value (optional)
-
-
Method Detail
-
getTagName
public java.lang.String getTagName()
The tag name which this listener is bound to.
-
isMapped
public boolean isMapped()
- Returns:
trueif a mapping attribute was specified
-
getValue
public abstract java.lang.Object getValue() throws ParseAbortExceptionTranslation method. Must be implemented by subclasses.- Throws:
ParseAbortException
-
getCharacters
public java.lang.String getCharacters()
Superclass method overridden to get characters from value attribute if such is specified.- Overrides:
getCharactersin classDefaultTagListener
-
processEndElement
public java.lang.Object processEndElement(ObjectProcessor processor) throws ParseAbortException
Description copied from class:DefaultTagListenerTo be overridden.- Specified by:
processEndElementin classDefaultTagListener- Returns:
- Object
- Throws:
ParseAbortException
-
-