|
||||||||||
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
public class InterpolatingConverter
An implementation of IInterpolatingConverter
which
has commonly used behavior.
Field Summary | |
---|---|
protected static IObjectMapper |
_BAD_OBJECT_MAPPER
A value that signals an error occurred converting a string to a arg map value to/from property value converter. |
protected static java.lang.Object |
_IGNORE_PROPERTY_VALUE
A value that indicates that a property value is to be monitored in the argument map, but not set by it. |
protected static java.util.Collection |
_IMPORTS
A collection of imports to add to the BeanShell interpreter. |
protected static java.util.Collection |
_STATIC_IMPORTS
A collection of static imports to add to the BeanShell interpreter. |
protected static IInterpolatingConverter |
_TO_OBJECT_MAPPER_CONVERTER
An converter to instances of IObjectMapper . |
static InterpolatingConverter |
DEFAULT_INSTANCE
The default instance of this class. |
Fields inherited from class com.taco.text.AbstractInterpolatingStringToObjectConverter |
---|
_defArgMap, _defBundle |
Constructor Summary | |
---|---|
InterpolatingConverter()
Create a new instance whose implementation of IStringToObjectConverter is incapable of resolving
references. |
|
InterpolatingConverter(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 |
_argMapReferenceToObject(InterpolatedValueMatchResult result,
java.util.ResourceBundle bundle,
INoReturnMap argMap,
KeyLookupRecord context)
Convert a result which is a reference to a value in the argument map to an object. |
protected java.util.Collection |
_getStandardImports()
Return a collection of imports to use for every invocation of _scriptSnippetToObject() . |
protected java.util.Collection |
_getStandardStaticImports()
Return a collection of static imports to use for every invocation of _scriptSnippetToObject() . |
protected java.lang.Object |
_literalResultToObject(InterpolatedValueMatchResult result,
java.util.ResourceBundle bundle,
INoReturnMap argMap,
KeyLookupRecord context)
Convert a result which is a literal to an object. |
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 |
_scriptSnippetToObject(java.lang.String code,
java.util.ResourceBundle bundle,
INoReturnMap argMap,
KeyLookupRecord context,
java.util.Map extraEnvironment,
java.util.Collection extraImports,
java.util.Collection extraStaticImports)
Given a code snippet, convert the code into an object. |
protected java.lang.Object |
_toObject(java.util.ResourceBundle bundle,
java.lang.String baseKey,
INoReturnMap argMap,
KeyLookupRecord context,
java.lang.String globalName)
If the value associated with baseKey is a non-null string,
use this instance to convert it to an object. |
protected static IObjectMapper |
_toObjectMapper(java.lang.String s,
java.util.ResourceBundle bundle,
INoReturnMap argMap)
Convert the string to an instance of IObjectMapper that
converts to or from argument map values. |
java.lang.Object |
clone()
|
java.lang.String |
name()
If the simple class name ends with "Converter" , return the
part before "Converter" . |
java.lang.Object |
toObject(InterpolatedValueMatchResult result,
java.util.ResourceBundle bundle,
INoReturnMap argMap,
KeyLookupRecord context)
Given a result that has just been parsed from a literal, return the object meant by the result. |
java.lang.Object |
toObject(java.util.ResourceBundle bundle,
java.lang.String baseKey,
INoReturnMap argMap,
KeyLookupRecord context)
Call _toObject(bundle, baseKey, argMap, context) . |
java.lang.Object |
toObject(java.lang.String s,
java.util.ResourceBundle bundle,
INoReturnMap argMap,
KeyLookupRecord context)
If s is a reference, resolve it using this instance as
both the resource and string converter for the eventual literal. |
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 |
---|
protected static final IObjectMapper _BAD_OBJECT_MAPPER
protected static final java.util.Collection _IMPORTS
PropertyChangeEvent
,
PropertyChangeListener
, and all classes in the
com.taco.text
and com.taco.swinger.text2gui
packages.
protected static final java.util.Collection _STATIC_IMPORTS
GlobalUtilities
and
SwingInvokeProxyFactory
.
protected static final java.lang.Object _IGNORE_PROPERTY_VALUE
protected static final IInterpolatingConverter _TO_OBJECT_MAPPER_CONVERTER
IObjectMapper
. This makes it
slightly easier for developers to write BeanShell expressions for one
since IObjectMapper
is automatically imported in the
BeanShell environment.
public static final InterpolatingConverter DEFAULT_INSTANCE
Constructor Detail |
---|
public InterpolatingConverter()
IStringToObjectConverter
is incapable of resolving
references.
public InterpolatingConverter(java.util.ResourceBundle bundle, INoReturnMap argMap)
IStringToObjectConverter
uses the specified resource
bundle and argument map to resolve references.
Method Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.Object toObject(java.util.ResourceBundle bundle, java.lang.String baseKey, INoReturnMap argMap, KeyLookupRecord context) throws java.text.ParseException, java.util.MissingResourceException
_toObject(bundle, baseKey, argMap, context)
. If
(baseKey< + ".globalName")
is mapped to a string, save the
result in the ""
property of the argument map,
which is another map.
toObject
in interface IInterpolatingResourceBundleToObjectConverter
java.text.ParseException
java.util.MissingResourceException
public java.lang.Object toObject(java.lang.String s, java.util.ResourceBundle bundle, INoReturnMap argMap, KeyLookupRecord context) throws java.text.ParseException, java.util.MissingResourceException
s
is a reference, resolve it using this instance as
both the resource and string converter for the eventual literal.
Otherwise, s
is a literal; call
_literalToObject()
on it.
toObject
in interface IInterpolatingStringToObjectConverter
java.text.ParseException
java.util.MissingResourceException
public java.lang.Object toObject(InterpolatedValueMatchResult result, java.util.ResourceBundle bundle, INoReturnMap argMap, KeyLookupRecord context) throws java.text.ParseException, java.util.MissingResourceException
java.text.ParseException
java.util.MissingResourceException
public java.lang.String name()
"Converter"
, return the
part before "Converter"
. Otherwise, just return the simple
class name.
name
in interface IInterpolatingConverter
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
baseKey
is a non-null string,
use this instance to convert it to an object. Otherwise, return the
object.
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
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.
java.text.ParseException
java.util.MissingResourceException
protected java.lang.Object _literalResultToObject(InterpolatedValueMatchResult result, java.util.ResourceBundle bundle, INoReturnMap argMap, KeyLookupRecord context) throws java.text.ParseException, java.util.MissingResourceException
java.text.ParseException
java.util.MissingResourceException
protected java.lang.Object _argMapReferenceToObject(InterpolatedValueMatchResult result, java.util.ResourceBundle bundle, INoReturnMap argMap, KeyLookupRecord context) throws java.text.ParseException, java.util.MissingResourceException
_IGNORE_PROPERTY_VALUE
. Also record the lookup in the
context.
java.text.ParseException
java.util.MissingResourceException
protected java.lang.Object _scriptSnippetToObject(java.lang.String code, java.util.ResourceBundle bundle, INoReturnMap argMap, KeyLookupRecord context, java.util.Map extraEnvironment, java.util.Collection extraImports, java.util.Collection extraStaticImports) throws java.text.ParseException
java.text.ParseException
protected java.util.Collection _getStandardImports()
_scriptSnippetToObject()
. The collection might not be
modifiable, since it is copied. This implementation returns the a
collection of fully qualified names of the
PropertyChangeEvent
and
PropertyChangeListener
classes, and package imports of
com.taco.text
and com.taco.swinger.text2gui
.
protected java.util.Collection _getStandardStaticImports()
_scriptSnippetToObject()
. The collection might not be
modifiable, since it is copied. This implementation returns a
collection consisting of the members of GlobalUtilities
and SwingInvokeProxyFactory
.
protected static IObjectMapper _toObjectMapper(java.lang.String s, java.util.ResourceBundle bundle, INoReturnMap argMap) throws java.text.ParseException, java.util.MissingResourceException
IObjectMapper
that
converts to or from argument map values. If the string is
null
or empty, return null
.
java.text.ParseException
java.util.MissingResourceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |