org.opencms.util
Class CmsCollectionsGenericWrapper

java.lang.Object
  extended by org.opencms.util.CmsCollectionsGenericWrapper

public final class CmsCollectionsGenericWrapper
extends java.lang.Object

Provides Map wrapping utility functions for Java generics.

Since:
8.0.0
Version:
$Revision: 1.4 $
Author:
Alexander Kandzior

Method Summary
static
<K,V> java.util.Map<K,V>
createLazyMap(org.apache.commons.collections.Transformer T)
          Provides a wrapper to access the LazyMap functionality that avoids warnings with Java 1.5 generic code.
static
<K,V> java.util.Map<K,V>
createLRUMap()
          Provides a wrapper to create a LRUMap that avoids warnings with Java 1.5 generic code.
static
<K,V> java.util.Map<K,V>
createLRUMap(int size)
          Provides a wrapper to create a LRUMap with the given size that avoids warnings with Java 1.5 generic code.
static
<K> java.util.Enumeration<K>
enumeration(java.util.Enumeration enumeration)
          Provides a wrapper to convert an enumeration that avoids warnings with Java 1.5 generic code.
static
<K> java.util.List<K>
list(java.lang.Object o)
          Provides a wrapper to convert an object into a list that avoids warnings with Java 1.5 generic code.
static
<K,V> java.util.Map<K,V>
map(java.lang.Object o)
          Provides a wrapper to convert an object into a map that avoids warnings with Java 1.5 generic code.
static
<K> java.util.Set<K>
set(java.lang.Object o)
          Provides a wrapper to convert an object into a set that avoids warnings with Java 1.5 generic code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createLazyMap

public static <K,V> java.util.Map<K,V> createLazyMap(org.apache.commons.collections.Transformer T)
Provides a wrapper to access the LazyMap functionality that avoids warnings with Java 1.5 generic code.

Type Parameters:
K - the type of keys maintained by the returned map
V - the type of mapped values
Parameters:
T - the transformer to use for the Lazy Map
Returns:
a LazyMap of the required generic type

createLRUMap

public static <K,V> java.util.Map<K,V> createLRUMap()
Provides a wrapper to create a LRUMap that avoids warnings with Java 1.5 generic code.

Type Parameters:
K - the type of keys maintained by the returned map
V - the type of mapped values
Returns:
a LRUMap of the required generic type

createLRUMap

public static <K,V> java.util.Map<K,V> createLRUMap(int size)
Provides a wrapper to create a LRUMap with the given size that avoids warnings with Java 1.5 generic code.

Type Parameters:
K - the type of keys maintained by the returned map
V - the type of mapped values
Parameters:
size - the initial size of the created Map
Returns:
a LRUMap with the given size of the required generic type

enumeration

public static <K> java.util.Enumeration<K> enumeration(java.util.Enumeration enumeration)
Provides a wrapper to convert an enumeration that avoids warnings with Java 1.5 generic code.

Type Parameters:
K - the type of the returned enumeration elements
Parameters:
enumeration - the enumeration to be converted
Returns:
a Enumeration with the required generic type

list

public static <K> java.util.List<K> list(java.lang.Object o)
Provides a wrapper to convert an object into a list that avoids warnings with Java 1.5 generic code.

Type Parameters:
K - the type of the returned list elements
Parameters:
o - the object to be converted
Returns:
a List with the required generic type

map

public static <K,V> java.util.Map<K,V> map(java.lang.Object o)
Provides a wrapper to convert an object into a map that avoids warnings with Java 1.5 generic code.

Type Parameters:
K - the type of keys maintained by the returned map
V - the type of mapped values
Parameters:
o - the object to be converted
Returns:
a Map of the required generic type

set

public static <K> java.util.Set<K> set(java.lang.Object o)
Provides a wrapper to convert an object into a set that avoids warnings with Java 1.5 generic code.

Type Parameters:
K - the type of the returned set elements
Parameters:
o - the object to be converted
Returns:
a Set with the required generic type