CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util
Class ConverterCollections

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.ConverterCollections

public abstract class ConverterCollections
extends Base

A collection of Collection implementation classes that use the Converter interface to convert the items stored in underlying collection objects.

Author:
cp 2002.02.08

Nested Class Summary
protected static class ConverterCollections.AbstractConverterEntry
          An abstract Map Entry that lazily converts the key and value.
static class ConverterCollections.ConverterCacheEvent
          A Converter CacheEvent views an underlying CacheEvent through a set of key and value Converters.
static class ConverterCollections.ConverterCollection
          A Converter Collection views an underlying Collection through a Converter.
static class ConverterCollections.ConverterEntry
          A Map Entry that lazily converts the key and value.
static class ConverterCollections.ConverterEntrySet
          A Converter Entry Set views an underlying Entry Set through a set of key and value Converters.
static class ConverterCollections.ConverterList
          A Converter List views an underlying List through a Converter.
static class ConverterCollections.ConverterListIterator
          A Converter ListIterator views an underlying ListIterator through a Converter.
static class ConverterCollections.ConverterMap
          A Converter Map views an underlying Map through a set of key and value Converters.
static class ConverterCollections.ConverterMapEvent
          A Converter MapEvent views an underlying MapEvent through a set of key and value Converters.
static class ConverterCollections.ConverterMapListener
          A converter MapListener that converts events of the underlying MapListener for the underlying map.
static class ConverterCollections.ConverterObservableMap
          A Converter ObservableMap views an underlying ObservableMap through a set of key and value Converters.
static class ConverterCollections.ConverterSet
          A Converter Set views an underlying Set through a Converter.
static class ConverterCollections.ConverterSortedMap
          A Converter SortedMap views an underlying SortedMap through a set of key and value Converters.
static class ConverterCollections.ConverterSortedSet
          A Converter SortedSet views an underlying SortedSet through a Converter.
 
Constructor Summary
ConverterCollections()
           
 
Method Summary
static Object[] convertArray(Object[] ao, Converter conv)
          Convert the contents of the passed array.
static Object[] convertArray(Object[] aoSrc, Converter conv, Object[] aoDest)
          Convert the contents of the passed source array into an array with the component type of the passed destination array, using the destination array itself if it is large enough, and placing a null in the first unused element of the destination array if it is larger than the source array.
static ConverterCollections.ConverterCollection getCollection(Collection col, Converter convUp, Converter convDown)
          Returns an instance of Collection that uses a Converter to view an underlying Collection.
static ConverterCollections.ConverterEntry getEntry(Map.Entry entry, Converter convKeyUp, Converter convValUp, Converter convValDown)
          Returns an instance of a MapEntry that uses Converters to retrieve the Entry's data.
static ConverterCollections.ConverterEntrySet getEntrySet(Collection set, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Returns a Converter instance of a Set that holds Entry objects for a ConverterMap.
static Iterator getIterator(Iterator iter, Converter conv)
          Returns an instance of Iterator that uses a Converter to view an underlying Iterator.
static ConverterCollections.ConverterList getList(List list, Converter convUp, Converter convDown)
          Returns a Converter instance of List.
static ConverterCollections.ConverterListIterator getListIterator(ListIterator iter, Converter convUp, Converter convDown)
          Returns a Converter instance of ListIterator.
static ConverterCollections.ConverterMap getMap(Map map, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Returns a Converter instance of Map.
static MapEvent getMapEvent(ObservableMap map, MapEvent event, Converter convKey, Converter convVal)
          Returns an instance of a MapEvent that uses Converters to retrieve the event data.
static ConverterCollections.ConverterObservableMap getObservableMap(ObservableMap map, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Returns a Converter instance of ObservableMap.
static ConverterCollections.ConverterSet getSet(Set set, Converter convUp, Converter convDown)
          Returns an instance of Set that uses a Converter to view an underlying Set.
static ConverterCollections.ConverterSortedMap getSortedMap(SortedMap map, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Returns a Converter instance of SortedMap.
static ConverterCollections.ConverterSortedSet getSortedSet(SortedSet set, Converter convUp, Converter convDown)
          Returns an instance of SortedSet that uses a Converter to view an underlying SortedSet.
 

Constructor Detail

ConverterCollections

public ConverterCollections()
Method Detail

getIterator

public static Iterator getIterator(Iterator iter,
                                   Converter conv)
Returns an instance of Iterator that uses a Converter to view an underlying Iterator.

Parameters:
iter - the underlying Iterator
conv - the Converter to view the underlying Iterator through
Returns:
an Iterator that views the passed Iterator through the specified Converter

getCollection

public static ConverterCollections.ConverterCollection getCollection(Collection col,
                                                                     Converter convUp,
                                                                     Converter convDown)
Returns an instance of Collection that uses a Converter to view an underlying Collection.

Parameters:
col - the underlying Collection
convUp - the Converter to view the underlying Collection through
convDown - the Converter to pass items down to the underlying Collection through
Returns:
a Collection that views the passed Collection through the specified Converter

getSet

public static ConverterCollections.ConverterSet getSet(Set set,
                                                       Converter convUp,
                                                       Converter convDown)
Returns an instance of Set that uses a Converter to view an underlying Set.

Parameters:
set - the underlying Set
convUp - the Converter to view the underlying Set through
convDown - the Converter to pass items down to the underlying Set through
Returns:
a Set that views the passed Set through the specified Converter

getSortedSet

public static ConverterCollections.ConverterSortedSet getSortedSet(SortedSet set,
                                                                   Converter convUp,
                                                                   Converter convDown)
Returns an instance of SortedSet that uses a Converter to view an underlying SortedSet.

Parameters:
set - the underlying SortedSet
convUp - the Converter to view the underlying SortedSet through
convDown - the Converter to pass items down to the underlying SortedSet through
Returns:
a SortedSet that views the passed SortedSet through the specified Converter

getList

public static ConverterCollections.ConverterList getList(List list,
                                                         Converter convUp,
                                                         Converter convDown)
Returns a Converter instance of List.

Parameters:
list - the underlying List
convUp - the Converter to view the underlying List through
convDown - the Converter to pass items down to the underlying List through
Returns:
a List that views the passed List through the specified Converter

getListIterator

public static ConverterCollections.ConverterListIterator getListIterator(ListIterator iter,
                                                                         Converter convUp,
                                                                         Converter convDown)
Returns a Converter instance of ListIterator.

Parameters:
iter - the underlying ListIterator
convUp - the Converter to view the underlying ListIterator through
convDown - the Converter to pass items down to the underlying ListIterator through
Returns:
a ListIterator that views the passed ListIterator through the specified Converter

getMap

public static ConverterCollections.ConverterMap getMap(Map map,
                                                       Converter convKeyUp,
                                                       Converter convKeyDown,
                                                       Converter convValUp,
                                                       Converter convValDown)
Returns a Converter instance of Map.

Parameters:
map - the underlying Map
convKeyUp - the Converter to view the underlying Map's keys through
convKeyDown - the Converter to use to pass keys down to the underlying Map
convValUp - the Converter to view the underlying Map's values through
convValDown - the Converter to use to pass values down to the underlying Map
Returns:
a Map that views the keys and values of the passed Map through the specified Converters

getObservableMap

public static ConverterCollections.ConverterObservableMap getObservableMap(ObservableMap map,
                                                                           Converter convKeyUp,
                                                                           Converter convKeyDown,
                                                                           Converter convValUp,
                                                                           Converter convValDown)
Returns a Converter instance of ObservableMap.

Parameters:
map - the underlying ObservableMap
convKeyUp - the Converter to view the underlying ObservableMap's keys through
convKeyDown - the Converter to use to pass keys down to the underlying ObservableMap
convValUp - the Converter to view the underlying ObservableMap's values through
convValDown - the Converter to use to pass values down to the underlying ObservableMap
Returns:
an ObservableMap that views the keys and values of the passed ObservableMap through the specified Converters

getSortedMap

public static ConverterCollections.ConverterSortedMap getSortedMap(SortedMap map,
                                                                   Converter convKeyUp,
                                                                   Converter convKeyDown,
                                                                   Converter convValUp,
                                                                   Converter convValDown)
Returns a Converter instance of SortedMap.

Parameters:
map - the underlying SortedMap
convKeyUp - the Converter to view the underlying SortedMap's keys through
convKeyDown - the Converter to use to pass keys down to the underlying SortedMap
convValUp - the Converter to view the underlying SortedMap's values through
convValDown - the Converter to use to pass values down to the underlying SortedMap
Returns:
a SortedMap that views the keys and values of the passed SortedMap through the specified Converters

getEntrySet

public static ConverterCollections.ConverterEntrySet getEntrySet(Collection set,
                                                                 Converter convKeyUp,
                                                                 Converter convKeyDown,
                                                                 Converter convValUp,
                                                                 Converter convValDown)
Returns a Converter instance of a Set that holds Entry objects for a ConverterMap.

Parameters:
set - the underlying Entry Set (or Collection of Map Entry objects)
convKeyUp - the Converter to view the underlying Entry Set's keys through
convKeyDown - the Converter to use to pass keys down to the underlying Entry Set
convValUp - the Converter to view the underlying Entry Set's values through
convValDown - the Converter to use to pass values down to the underlying Entry Set
Returns:
a Converter Set that views the keys and values of the underlying Set's Map.Entry objects through the specified key and value Converters

getEntry

public static ConverterCollections.ConverterEntry getEntry(Map.Entry entry,
                                                           Converter convKeyUp,
                                                           Converter convValUp,
                                                           Converter convValDown)
Returns an instance of a MapEntry that uses Converters to retrieve the Entry's data.

Parameters:
entry - the underlying Entry
convKeyUp - the Converter to view the underlying Entry's key
convValUp - the Converter to view the underlying Entry's value
convValDown - the Converter to change the underlying Entry's value
Returns:
a ConverterEntry that converts the passed entry data using the specified Converters

getMapEvent

public static MapEvent getMapEvent(ObservableMap map,
                                   MapEvent event,
                                   Converter convKey,
                                   Converter convVal)
Returns an instance of a MapEvent that uses Converters to retrieve the event data.

Parameters:
map - the new event's source
event - the underlying MapEvent
convKey - the Converter to view the underlying MapEvent's key
convVal - the Converter to view the underlying MapEvent's values
Returns:
a MapEvent that converts the passed event data using the specified Converter

convertArray

public static Object[] convertArray(Object[] ao,
                                    Converter conv)
Convert the contents of the passed array. The conversion is done "in place" in the passed array.

This helper method is intended to support the functionality of Collection.toArray.

Parameters:
ao - an array of Objects to convert
conv - the Converter to use to convert the objects
Returns:
the passed array

convertArray

public static Object[] convertArray(Object[] aoSrc,
                                    Converter conv,
                                    Object[] aoDest)
Convert the contents of the passed source array into an array with the component type of the passed destination array, using the destination array itself if it is large enough, and placing a null in the first unused element of the destination array if it is larger than the source array.

This helper method is intended to support the functionality of Collection.toArray.

Parameters:
aoSrc - an array of Objects to convert
conv - the Converter to use to convert the objects
aoDest - the array to use to place the converted objects in if large enough, otherwise the array from which to obtain the component type to create a new array that is large enough
Returns:
an array whose component type is the same as the passed destination array and whose contents are the converted objects

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation