com.taco.text
Class AtomConverter

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

public class AtomConverter
extends InterpolatingConverter

An interpolating string and resource bundle converter of atomic data. Once a literal string has been found, this class uses an instance of StringToObjectConverter to convert the string to an object.


Field Summary
protected  IStringToObjectConverter _stringConverter
          The string converter that _literalToObject() uses.
static AtomConverter BOOLEAN_CONVERTER
          A converter to instances of Boolean.
static AtomConverter CHARACTER_CONVERTER
          A converter to instances of Character.
static AtomConverter CLASS_CONVERTER
          A converter to instances of Class.
static AtomConverter DOUBLE_CONVERTER
          A converter to instances of Double.
static AtomConverter FLOAT_CONVERTER
          A converter to instances of Float.
static AtomConverter INTEGER_CONVERTER
          A converter to instances of Integer.
static AtomConverter LOCALE_CONVERTER
          A converter to instances of Locale.
static AtomConverter LONG_CONVERTER
          A converter to instances of Long.
 
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
AtomConverter(IStringToObjectConverter stringConverter)
           
 
Method Summary
protected  java.lang.Object _literalToObject(java.lang.String s, java.util.ResourceBundle bundle, INoReturnMap argMap, java.lang.String globalName)
          Use the string converter to convert s.
 java.lang.String name()
          Use the string to object converter's simple class name to derive a name for this converter.
 
Methods inherited from class com.taco.text.InterpolatingConverter
_argMapReferenceToObject, _getStandardImports, _getStandardStaticImports, _literalResultToObject, _scriptSnippetToObject, _toObject, _toObjectMapper, clone, toObject, 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
 

Field Detail

_stringConverter

protected final IStringToObjectConverter _stringConverter
The string converter that _literalToObject() uses.


BOOLEAN_CONVERTER

public static final AtomConverter BOOLEAN_CONVERTER
A converter to instances of Boolean.


CHARACTER_CONVERTER

public static final AtomConverter CHARACTER_CONVERTER
A converter to instances of Character.


INTEGER_CONVERTER

public static final AtomConverter INTEGER_CONVERTER
A converter to instances of Integer.


LONG_CONVERTER

public static final AtomConverter LONG_CONVERTER
A converter to instances of Long.


FLOAT_CONVERTER

public static final AtomConverter FLOAT_CONVERTER
A converter to instances of Float.


DOUBLE_CONVERTER

public static final AtomConverter DOUBLE_CONVERTER
A converter to instances of Double.


CLASS_CONVERTER

public static final AtomConverter CLASS_CONVERTER
A converter to instances of Class.


LOCALE_CONVERTER

public static final AtomConverter LOCALE_CONVERTER
A converter to instances of Locale.

Constructor Detail

AtomConverter

public AtomConverter(IStringToObjectConverter stringConverter)
Method Detail

_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
Use the string converter to convert s. If that fails, and s is a braced string, treat is as a script and return the result of evaluating the script.

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

name

public java.lang.String name()
Use the string to object converter's simple class name to derive a name for this converter. If the converter's class name starts with "StringTo", discard it. Also discard the trailing "Converter" suffix if present.

Specified by:
name in interface IInterpolatingConverter
Overrides:
name in class InterpolatingConverter