|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.taco.text.AbstractInterpolatingStringToObjectConverter
com.taco.text.InterpolatingConverter
com.taco.text.StringConverter
com.taco.text.QuotedStringConverter
public class QuotedStringConverter
A converter from both resource bundles and strings to strings. If the string is quoted, the quotes will be stripped, and escaped characters will be unescaped. If the string is braced, the first part after the brace will be interpreted as a message format, and the second part will be interpreted as an array of instances to use to format the message.
Field Summary | |
---|---|
static QuotedStringConverter |
instance
The singleton 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 |
QuotedStringConverter()
|
Method Summary | |
---|---|
protected java.lang.String |
_formatMessage(java.lang.CharSequence cs,
java.util.ResourceBundle bundle,
INoReturnMap argMap)
Given a message format then an optional array of instances to use in the format, form the message and return it. |
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. |
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)
A convenience method that returns the result casted to a string. |
Methods inherited from class com.taco.text.StringConverter |
---|
toString |
Methods inherited from class com.taco.text.InterpolatingConverter |
---|
_argMapReferenceToObject, _getStandardImports, _getStandardStaticImports, _literalResultToObject, _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 |
---|
public static final QuotedStringConverter instance
Constructor Detail |
---|
protected QuotedStringConverter()
Method Detail |
---|
public java.lang.String toString(java.util.ResourceBundle bundle, java.lang.String baseKey, INoReturnMap argMap) throws java.text.ParseException, java.util.MissingResourceException
toString
in class StringConverter
java.text.ParseException
java.util.MissingResourceException
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
StringConverter
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.
_toObject
in class StringConverter
java.text.ParseException
java.util.MissingResourceException
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
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.
_literalToObject
in class InterpolatingConverter
java.text.ParseException
java.util.MissingResourceException
protected java.lang.String _formatMessage(java.lang.CharSequence cs, java.util.ResourceBundle bundle, INoReturnMap argMap) throws java.text.ParseException
java.text.ParseException
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |