public abstract class ConverterCollections extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
ConverterCollections.AbstractConverterEntry<FK,TK,FV,TV>
An abstract Map Entry that lazily converts the key and value.
|
static class |
ConverterCollections.ConverterCacheEntry
A ConfigurableCacheMap.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.ConverterCacheListener
A converter MapListener that converts events of the underlying
MapListener for the underlying NamedCache.
|
static class |
ConverterCollections.ConverterCacheMap<FK,TK,FV,TV>
A Converter CacheMap views an underlying CacheMap through a set of key
and value Converters.
|
static class |
ConverterCollections.ConverterCollection<F,T>
A Converter Collection views an underlying Collection through a
Converter.
|
static class |
ConverterCollections.ConverterComparator<F,T>
A Comparator that Converts the elements before
comparing them.
|
static class |
ConverterCollections.ConverterConcurrentMap<FK,TK,FV,TV>
A Converter ConcurrentMap views an underlying ConcurrentMap through a
set of key and value Converters.
|
static class |
ConverterCollections.ConverterEntry<FK,TK,FV,TV>
A Map Entry that lazily converts the key and value.
|
static class |
ConverterCollections.ConverterEntrySet<FK,TK,FV,TV>
A Converter Entry Set views an underlying Entry Set through a set of
key and value Converters.
|
static class |
ConverterCollections.ConverterEnumerator<F,T>
Provide an implementation of an enumerator which converts each of the
items which it enumerates.
|
static class |
ConverterCollections.ConverterHolder<F,T>
A Holder that converts the element before returning them.
|
static class |
ConverterCollections.ConverterInvocableMap<FK,TK,FV,TV>
A Converter InvocableMap views an underlying InvocableMap through a
set of key and value Converters.
|
static class |
ConverterCollections.ConverterList<F,T>
A Converter List views an underlying List through a Converter.
|
static class |
ConverterCollections.ConverterListIterator<F,T>
A Converter ListIterator views an underlying ListIterator through a
Converter.
|
static class |
ConverterCollections.ConverterLongArray<F,T>
ConverterLongArray converts the value of the LongArray from its raw form
(type
F ) to the desired from (type T ). |
static class |
ConverterCollections.ConverterMap<FK,TK,FV,TV>
A Converter Map views an underlying Map through a set of key and value
Converters.
|
static class |
ConverterCollections.ConverterMapEvent
A ConverterMapEvent 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.ConverterNamedCache<FK,TK,FV,TV>
A Converter NamedCache views an underlying NamedCache through a set of
key and value Converters.
|
static class |
ConverterCollections.ConverterObservableMap<FK,TK,FV,TV>
A Converter ObservableMap views an underlying ObservableMap through a
set of key and value Converters.
|
static class |
ConverterCollections.ConverterQueryMap<FK,TK,FV,TV>
A Converter QueryMap views an underlying QueryMap through a set of key
and value Converters.
|
static class |
ConverterCollections.ConverterSet<F,T>
A Converter Set views an underlying Set through a Converter.
|
static class |
ConverterCollections.ConverterSortedMap<FK,TK,FV,TV>
A Converter SortedMap views an underlying SortedMap through a set of
key and value Converters.
|
static class |
ConverterCollections.ConverterSortedSet<F,T>
A Converter SortedSet views an underlying SortedSet through a
Converter.
|
Constructor and Description |
---|
ConverterCollections() |
Modifier and Type | Method and Description |
---|---|
static <F,I,T> Converter<F,T> |
combine(Converter<F,I> converter1,
Converter<I,T> converter2)
Create a new converter by combining two existing converters.
|
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 <FK,TK,FV,TV> |
getCacheMap(CacheMap<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of CacheMap.
|
static <F,T> ConverterCollections.ConverterCollection<F,T> |
getCollection(Collection<F> col,
Converter<F,T> convUp,
Converter<T,F> convDown)
Returns an instance of Collection that uses a Converter to view an
underlying Collection.
|
static <FK,TK,FV,TV> |
getConcurrentMap(ConcurrentMap<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of ConcurrentMap.
|
static <F,T> ConverterCollections.ConverterHolder<F,T> |
getConverterHolder(F value,
Converter<F,T> convUp)
Returns a Converter instance of Holder..
|
static <FK,TK,FV,TV> |
getEntry(Map.Entry<FK,FV> entry,
Converter<FK,TK> convKeyUp,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns an instance of a MapEntry that uses Converters to retrieve
the Entry's data.
|
static <FK,TK,FV,TV> |
getEntrySet(Collection<Map.Entry<FK,FV>> set,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of a Set that holds Entry objects for a
ConverterMap.
|
static <FK,TK,FV,TV> |
getInvocableMap(InvocableMap<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of InvocableMap.
|
static <F,T> Iterator<T> |
getIterator(Iterator<F> iter,
Converter<F,T> conv)
Returns an instance of Iterator that uses a Converter to view an
underlying Iterator.
|
static <F,T> ConverterCollections.ConverterList<F,T> |
getList(List<F> list,
Converter<F,T> convUp,
Converter<T,F> convDown)
Returns a Converter instance of List.
|
static <F,T> ConverterCollections.ConverterListIterator<F,T> |
getListIterator(ListIterator<F> iter,
Converter<F,T> convUp,
Converter<T,F> convDown)
Returns a Converter instance of ListIterator.
|
static <F,T> LongArray<T> |
getLongArray(LongArray<F> la,
Converter<F,T> convUp,
Converter<T,F> convDown)
Returns a LongArray storing values with type
F and converting
to type V as and when required. |
static <FK,TK,FV,TV> |
getMap(Map<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> 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's data.
|
static MapEvent |
getMapEvent(ObservableMap map,
MapEvent event,
Converter convKey,
Converter convVal,
BackingMapManagerContext context)
Returns an instance of a MapEvent that uses Converters to retrieve the
event's data, and additionally provides access to the
BackingMapManagerContext.
|
static MapListener |
getMapListener(ObservableMap map,
MapListener listener,
Converter convKey,
Converter convVal)
Returns a converter listener for the specified listener and Converters.
|
static <FK,FV,TK,TV> |
getNamedCache(NamedCache<FK,FV> cache,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of NamedCache that converts between the raw/from
types to the desired/to types.
|
static <FK,TK,FV,TV> |
getObservableMap(ObservableMap<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of ObservableMap.
|
static <FK,TK,FV,TV> |
getQueryMap(QueryMap<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of QueryMap.
|
static <F,T> ConverterCollections.ConverterSet<F,T> |
getSet(Set<F> set,
Converter<F,T> convUp,
Converter<T,F> convDown)
Returns an instance of Set that uses a Converter to view an
underlying Set.
|
static <FK,TK,FV,TV> |
getSortedMap(SortedMap<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Returns a Converter instance of SortedMap.
|
static <F,T> ConverterCollections.ConverterSortedSet<F,T> |
getSortedSet(SortedSet<F> set,
Converter<F,T> convUp,
Converter<T,F> convDown)
Returns an instance of SortedSet that uses a Converter to view an
underlying SortedSet.
|
public static <F,T> Iterator<T> getIterator(Iterator<F> iter, Converter<F,T> conv)
F
- the type of elements in the underlying IteratorT
- the type that the elements should be converted toiter
- the underlying Iteratorconv
- the Converter to view the underlying Iterator throughpublic static <F,T> ConverterCollections.ConverterCollection<F,T> getCollection(Collection<F> col, Converter<F,T> convUp, Converter<T,F> convDown)
F
- the type of elements in the underlying CollectionT
- the type that the elements should be converted tocol
- the underlying CollectionconvUp
- the Converter to view the underlying Collection
throughconvDown
- the Converter to pass items down to the underlying
Collection throughpublic static <F,T> ConverterCollections.ConverterSet<F,T> getSet(Set<F> set, Converter<F,T> convUp, Converter<T,F> convDown)
F
- the type of elements in the underlying SetT
- the type that the elements should be converted toset
- the underlying SetconvUp
- the Converter to view the underlying Set
throughconvDown
- the Converter to pass items down to the underlying
Set throughpublic static <F,T> ConverterCollections.ConverterSortedSet<F,T> getSortedSet(SortedSet<F> set, Converter<F,T> convUp, Converter<T,F> convDown)
F
- the type of elements in the underlying SortedSetT
- the type that the elements should be converted toset
- the underlying SortedSetconvUp
- the Converter to view the underlying SortedSet
throughconvDown
- the Converter to pass items down to the underlying
SortedSet throughpublic static <F,T> ConverterCollections.ConverterList<F,T> getList(List<F> list, Converter<F,T> convUp, Converter<T,F> convDown)
F
- the type of elements in the underlying listT
- the type that the elements should be converted tolist
- the underlying ListconvUp
- the Converter to view the underlying List
throughconvDown
- the Converter to pass items down to the underlying
List throughpublic static <F,T> ConverterCollections.ConverterListIterator<F,T> getListIterator(ListIterator<F> iter, Converter<F,T> convUp, Converter<T,F> convDown)
F
- the type of elements in the underlying ListIteratorT
- the type that the elements should be converted toiter
- the underlying ListIteratorconvUp
- the Converter to view the underlying list
throughconvDown
- the Converter to pass items down to the underlying
ListIterator throughpublic static <FK,TK,FV,TV> ConverterCollections.ConverterMap<FK,TK,FV,TV> getMap(Map<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
FK
- the type of the keys in the underlying MapTK
- the type that the keys should be converted toFV
- the type of the values in the underlying MapTV
- the type that the values should be converted tomap
- the underlying MapconvKeyUp
- the Converter to view the underlying Map's keys
throughconvKeyDown
- the Converter to use to pass keys down to the
underlying MapconvValUp
- the Converter to view the underlying Map's values
throughconvValDown
- the Converter to use to pass values down to the
underlying Mappublic static <FK,TK,FV,TV> ConverterCollections.ConverterSortedMap<FK,TK,FV,TV> getSortedMap(SortedMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
FK
- the type of the keys in the underlying SortedMapTK
- the type that the keys should be converted toFV
- the type of the values in the underlying SortedMapTV
- the type that the values should be converted tomap
- the underlying SortedMapconvKeyUp
- the Converter to view the underlying SortedMap's
keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying SortedMapconvValUp
- the Converter to view the underlying SortedMap's
values throughconvValDown
- the Converter to use to pass values down to the
underlying SortedMappublic static <FK,TK,FV,TV> ConverterCollections.ConverterEntrySet<FK,TK,FV,TV> getEntrySet(Collection<Map.Entry<FK,FV>> set, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
FK
- the type of the keys in the underlying EntrySetTK
- the type that the keys should be converted toFV
- the type of the values in the underlying EntrySetTV
- the type that the values should be converted toset
- the underlying Entry Set (or Collection of Map
Entry objects)convKeyUp
- the Converter to view the underlying Entry Set's
keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying Entry SetconvValUp
- the Converter to view the underlying Entry Set's
values throughconvValDown
- the Converter to use to pass values down to the
underlying Entry Setpublic static <FK,TK,FV,TV> ConverterCollections.ConverterEntry<FK,TK,FV,TV> getEntry(Map.Entry<FK,FV> entry, Converter<FK,TK> convKeyUp, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
FK
- the type of the keys in the underlying EntryTK
- the type that the keys should be converted toFV
- the type of the values in the underlying EntryTV
- the type that the values should be converted toentry
- the underlying EntryconvKeyUp
- the Converter to view the underlying Entry's keyconvValUp
- the Converter to view the underlying Entry's valueconvValDown
- the Converter to change the underlying Entry's valuepublic static <F,T> ConverterCollections.ConverterHolder<F,T> getConverterHolder(F value, Converter<F,T> convUp)
F
- the type of the underlying valueT
- the type of the converted valuevalue
- the underlying valueconvUp
- the Converter to view the underlying valuepublic static <F,T> LongArray<T> getLongArray(LongArray<F> la, Converter<F,T> convUp, Converter<T,F> convDown)
F
and converting
to type V
as and when required.F
- the raw typeT
- the desired typela
- the LongArray with raw typesconvUp
- a Converter to convert to the desired typeconvDown
- a Converter to convert to the raw typepublic static <FK,TK,FV,TV> ConcurrentMap<TK,TV> getConcurrentMap(ConcurrentMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
map
- the underlying ConcurrentMapconvKeyUp
- the Converter to view the underlying
ConcurrentMap's keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying ConcurrentMapconvValUp
- the Converter to view the underlying
ConcurrentMap's values throughconvValDown
- the Converter to use to pass values down to the
underlying ConcurrentMappublic static <FK,TK,FV,TV> InvocableMap<TK,TV> getInvocableMap(InvocableMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
map
- the underlying InvocableMapconvKeyUp
- the Converter to view the underlying
InvocableMap's keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying InvocableMapconvValUp
- the Converter to view the underlying
InvocableMap's values throughconvValDown
- the Converter to use to pass values down to the
underlying InvocableMappublic static <FK,TK,FV,TV> ObservableMap<TK,TV> getObservableMap(ObservableMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
map
- the underlying ObservableMapconvKeyUp
- the Converter to view the underlying
ObservableMap's keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying ObservableMapconvValUp
- the Converter to view the underlying
ObservableMap's values throughconvValDown
- the Converter to use to pass values down to the
underlying ObservableMappublic static <FK,TK,FV,TV> QueryMap<TK,TV> getQueryMap(QueryMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
map
- the underlying QueryMapconvKeyUp
- the Converter to view the underlying QueryMap's
keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying QueryMapconvValUp
- the Converter to view the underlying QueryMap's
values throughconvValDown
- the Converter to use to pass values down to the
underlying QueryMappublic static <FK,TK,FV,TV> CacheMap<TK,TV> getCacheMap(CacheMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
map
- the underlying CacheMapconvKeyUp
- the Converter to view the underlying CacheMap's
keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying CacheMapconvValUp
- the Converter to view the underlying CacheMap's
values throughconvValDown
- the Converter to use to pass values down to the
underlying CacheMappublic static <FK,FV,TK,TV> NamedCache<TK,TV> getNamedCache(NamedCache<FK,FV> cache, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
There is a strong disclaimer in the use of this implementation:
This conversion is entirely performed locally and therefore when using
methods such as invoke
, or aggregate
, or
entrySet(Filter)
, the
provided agent (EntryProcessor
, or EntryAggregator
, or Filter
) do not go through the provided converters.
Hence the given agent(s) must operate against the raw types.
Streams are not supported.
cache
- the underlying NamedCacheconvKeyUp
- the Converter to view the underlying NamedCache's
keys throughconvKeyDown
- the Converter to use to pass keys down to the
underlying NamedCacheconvValUp
- the Converter to view the underlying NamedCache's
values throughconvValDown
- the Converter to use to pass values down to the
underlying NamedCachepublic static MapEvent getMapEvent(ObservableMap map, MapEvent event, Converter convKey, Converter convVal)
map
- the new event's sourceevent
- the underlying MapEventconvKey
- the Converter to view the underlying MapEvent's keyconvVal
- the Converter to view the underlying MapEvent's valuespublic static MapEvent getMapEvent(ObservableMap map, MapEvent event, Converter convKey, Converter convVal, BackingMapManagerContext context)
map
- the new event's sourceevent
- the underlying MapEventconvKey
- the Converter to view the underlying MapEvent's keyconvVal
- the Converter to view the underlying MapEvent's valuescontext
- the BackingMapManagerContext used to deserialize the
underlying valuespublic static MapListener getMapListener(ObservableMap map, MapListener listener, Converter convKey, Converter convVal)
map
- the Map that should be the source for converted eventslistener
- the underlying MapListenerconvKey
- the Converter to view the underlying MapEvent's keyconvVal
- the Converter to view the underlying MapEvent's valuespublic static Object[] convertArray(Object[] ao, Converter conv)
This helper method is intended to support the functionality of Collection.toArray.
ao
- an array of Objects to convertconv
- the Converter to use to convert the objectspublic static Object[] convertArray(Object[] aoSrc, Converter conv, Object[] aoDest)
This helper method is intended to support the functionality of Collection.toArray.
aoSrc
- an array of Objects to convertconv
- the Converter to use to convert the objectsaoDest
- 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
enoughpublic static <F,I,T> Converter<F,T> combine(Converter<F,I> converter1, Converter<I,T> converter2)
F
- the "from" type for the first converterI
- the "to" type for the first converter and the "from" type for the secondT
- the "to" type for the second converterconverter1
- the first converterconverter2
- the second converter