com.taco.text
Class RangeConverter

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

public class RangeConverter
extends InterpolatingConverter

A converter to a 2-element int array representing a range.


Field Summary
static RangeConverter 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 RangeConverter()
           
  RangeConverter(java.util.ResourceBundle bundle, INoReturnMap argMap)
           
 
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.
protected  java.lang.Object _toObject(java.util.ResourceBundle bundle, java.lang.String baseKey, INoReturnMap argMap, KeyLookupRecord context, java.lang.String globalName)
          If the base key is mapped to an integer array, return it.
static void main(java.lang.String[] args)
           
static java.util.List toRangeList(int[] indices)
          Convert an array of indices into a list of ranges.
 
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

instance

public static final RangeConverter instance
The singleton instance of this class.

Constructor Detail

RangeConverter

protected RangeConverter()

RangeConverter

public RangeConverter(java.util.ResourceBundle bundle,
                      INoReturnMap argMap)
Method Detail

main

public static void main(java.lang.String[] args)

toRangeList

public static final java.util.List toRangeList(int[] indices)
Convert an array of indices into a list of ranges.


_toObject

protected final 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 the base key is mapped to an integer array, return it. If it is mapped to a string, convert the string using this class. Otherwise, read the "start" and "end" sub-keys, and convert the values to integers. Using these two values, return a new integer array.

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

_literalToObject

protected final 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