com.taco.text
Class PunctuationStrippingConverter

java.lang.Object
  extended by com.taco.text.AbstractInterpolatingStringToObjectConverter
      extended by com.taco.text.InterpolatingConverter
          extended by com.taco.text.PunctuationStrippingConverter
All Implemented Interfaces:
IInterpolatingConverter, IInterpolatingStringToObjectConverter, IStringToObjectConverter, IInterpolatingResourceBundleToObjectConverter, java.lang.Cloneable

public class PunctuationStrippingConverter
extends InterpolatingConverter

A converter that strips leading and trailing punctuation from a string before delegating to another converter.


Field Summary
 
Fields inherited from class com.taco.text.InterpolatingConverter
_BAD_OBJECT_MAPPER, _IGNORE_PROPERTY_VALUE, _IMPORTS, _STATIC_IMPORTS, _TO_OBJECT_MAPPER_CONVERTER, DEFAULT_INSTANCE
 
Fields inherited from class com.taco.text.AbstractInterpolatingStringToObjectConverter
_defArgMap, _defBundle
 
Constructor Summary
PunctuationStrippingConverter(IInterpolatingConverter converter, char punctuationChar)
          Create a new instance that strips the argument leading punctuation character and the corresponding trailing punctuation character from strings.
 
Method Summary
protected  java.lang.Object _literalToObject(java.lang.String s, java.util.ResourceBundle bundle, INoReturnMap argMap, java.lang.String globalName)
          Given s, which is a string literal, not a reference to a resource bundle key or a key in the argument map, convert s to an object.
 java.lang.Object toObject(java.util.ResourceBundle bundle, java.lang.String baseKey, INoReturnMap argMap, KeyLookupRecord context)
          Simply delegate to the converter specified in the constructor.
 
Methods inherited from class com.taco.text.InterpolatingConverter
_argMapReferenceToObject, _getStandardImports, _getStandardStaticImports, _literalResultToObject, _scriptSnippetToObject, _toObject, _toObjectMapper, clone, name, toObject, toObject
 
Methods inherited from class com.taco.text.AbstractInterpolatingStringToObjectConverter
toObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PunctuationStrippingConverter

public PunctuationStrippingConverter(IInterpolatingConverter converter,
                                     char punctuationChar)
Create a new instance that strips the argument leading punctuation character and the corresponding trailing punctuation character from strings. The strings are then converted by the argument converter. Resource bundles are converted by the argument converter directly.

Method Detail

toObject

public java.lang.Object toObject(java.util.ResourceBundle bundle,
                                 java.lang.String baseKey,
                                 INoReturnMap argMap,
                                 KeyLookupRecord context)
                          throws java.text.ParseException,
                                 java.util.MissingResourceException
Simply delegate to the converter specified in the constructor.

Specified by:
toObject in interface IInterpolatingResourceBundleToObjectConverter
Overrides:
toObject in class InterpolatingConverter
Throws:
java.text.ParseException
java.util.MissingResourceException

_literalToObject

protected java.lang.Object _literalToObject(java.lang.String s,
                                            java.util.ResourceBundle bundle,
                                            INoReturnMap argMap,
                                            java.lang.String globalName)
                                     throws java.text.ParseException,
                                            java.util.MissingResourceException
Description copied from class: InterpolatingConverter

Given s, which is a string literal, not a reference to a resource bundle key or a key in the argument map, convert s to an object.

*

This implementation simply returns s unchanged.

Overrides:
_literalToObject in class InterpolatingConverter
Throws:
java.text.ParseException
java.util.MissingResourceException