com.taco.text
Class StringConverter

java.lang.Object
  extended by com.taco.text.AbstractInterpolatingStringToObjectConverter
      extended by com.taco.text.InterpolatingConverter
          extended by com.taco.text.StringConverter
All Implemented Interfaces:
IInterpolatingConverter, IInterpolatingStringToObjectConverter, IStringToObjectConverter, IInterpolatingResourceBundleToObjectConverter, java.lang.Cloneable
Direct Known Subclasses:
QuotedStringConverter

public class StringConverter
extends InterpolatingConverter

A converter from both resource bundles and strings to strings.


Field Summary
static StringConverter instance
          The default instance of this class.
 
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
protected StringConverter()
          Create a new instance whose implementation of IStringToObjectConverter is incapable of resolving references.
  StringConverter(java.util.ResourceBundle bundle, INoReturnMap argMap)
          Create a new instance whose implementation of IStringToObjectConverter uses the specified resource bundle and argument map to resolve references.
 
Method Summary
protected  java.lang.Object _toObject(java.util.ResourceBundle bundle, java.lang.String baseKey, INoReturnMap argMap, KeyLookupRecord context, java.lang.String globalName)
          If baseKey is mapped to null, return null.
static void main(java.lang.String[] args)
          A simple test program.
 java.lang.String toString(java.util.ResourceBundle bundle, java.lang.String baseKey, INoReturnMap argMap)
          Call toObject() with the same argument and cast the result to a String.
 java.lang.String toString(java.lang.String s, java.util.ResourceBundle bundle, INoReturnMap argMap)
          Call toObject() with the same argument and cast the result to a String.
 
Methods inherited from class com.taco.text.InterpolatingConverter
_argMapReferenceToObject, _getStandardImports, _getStandardStaticImports, _literalResultToObject, _literalToObject, _scriptSnippetToObject, _toObjectMapper, clone, name, 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

instance

public static final StringConverter instance
The default instance of this class.

Constructor Detail

StringConverter

protected StringConverter()
Create a new instance whose implementation of IStringToObjectConverter is incapable of resolving references. Since the default instance uses this constructor, this is protected.


StringConverter

public StringConverter(java.util.ResourceBundle bundle,
                       INoReturnMap argMap)
Create a new instance whose implementation of IStringToObjectConverter uses the specified resource bundle and argument map to resolve references.

Method Detail

toString

public java.lang.String toString(java.lang.String s,
                                 java.util.ResourceBundle bundle,
                                 INoReturnMap argMap)
                          throws java.text.ParseException,
                                 java.util.MissingResourceException
Call toObject() with the same argument and cast the result to a String. This is a convenience method.

Throws:
java.text.ParseException
java.util.MissingResourceException

toString

public java.lang.String toString(java.util.ResourceBundle bundle,
                                 java.lang.String baseKey,
                                 INoReturnMap argMap)
                          throws java.text.ParseException,
                                 java.util.MissingResourceException
Call toObject() with the same argument and cast the result to a String. This is a convenience method.

Throws:
java.text.ParseException
java.util.MissingResourceException

_toObject

protected java.lang.Object _toObject(java.util.ResourceBundle bundle,
                                     java.lang.String baseKey,
                                     INoReturnMap argMap,
                                     KeyLookupRecord context,
                                     java.lang.String globalName)
                              throws java.text.ParseException,
                                     java.util.MissingResourceException
If baseKey is mapped to null, return null. If it is mapped to a string, convert it to another string using this instance as a string to string converter. Otherwise, convert the mapped value to a string by calling its toString() method.

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

main

public static void main(java.lang.String[] args)
A simple test program.