Class TokenizedStringParameterDecoder
- java.lang.Object
-
- org.smooks.engine.resource.config.ParameterDecoder<String>
-
- org.smooks.engine.resource.config.TokenizedStringParameterDecoder
-
- All Implemented Interfaces:
ContentHandler
public class TokenizedStringParameterDecoder extends ParameterDecoder<String>
ParameterDecoderused to tokenize a parameter values into aListorHashSet. Tokenizes parameter values into aList(param-type="string-list") orHashSet(param-type="string-hashset") usingStringTokenizer. Two default configurations of this decoder are pre-installed for all profiles. They're named "string-list" and "string-hashset".Example Usage
The following example illustrates use of the pre-installed "string-hashset" decoder: Configuration:<resource-config target-profile="html4" selector="XXX"> <resource>com.acme.XXXContentDeliveryUnit</resource> <param name="blockLevelElements" type="string-hashset"> p,h1,h2,h3,h4,h5,h6,div,ul,ol,dl,menu,dir,pre,hr,blockquote,address,center,noframes,isindex,fieldset,table </param> </resource-config>Usage:
... and "com.acme.XXXContentDeliveryUnit" accesses this parameter value as follows:
Note, we will make this filter easier in the next release. You'll be able to call a method such as "getDecodedParameter" on theParameterparam =resourceConfig.getParameter("blockLevelElements");HashSetblockLevelElements = (HashSet)param.getValue(ContentDeliveryConfig);ResourceConfig, returning a decoded parameter Object.See
ResourceConfig.- Author:
- tfennelly
-
-
Constructor Summary
Constructors Constructor Description TokenizedStringParameterDecoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectdecodeValue(String value)Decodes the value based on the smooks-resource configuration passed in the constructor.voidsetConfiguration(ResourceConfig resourceConfig)Public constructor.
-
-
-
Method Detail
-
setConfiguration
public void setConfiguration(ResourceConfig resourceConfig)
Public constructor.- Parameters:
resourceConfig- Configuration.
-
decodeValue
public Object decodeValue(String value) throws ParameterDecodeException
Decodes the value based on the smooks-resource configuration passed in the constructor.- Specified by:
decodeValuein classParameterDecoder<String>- Parameters:
value- The value to be decoded.- Returns:
- The decode value Object.
- Throws:
ParameterDecodeException- Unable to decode parameter value.
-
-