Package org.zkoss.lang
Class Generics
java.lang.Object
org.zkoss.lang.Generics
Utilities to handle generic types, such as converting a non-type object
to a generic type without warning.
- Since:
- 6.0.0
- Author:
- tomyeh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final <T> Class<T>Returns a type-safe generic class of the given type-less class.static final <T> TForce to cast an object to the given type.static final <T> ThreadLocal<T>cast(ThreadLocal tl) Returns a type-safe generic thread-local of the given un-typed thread-local.static final <T> Collection<T>cast(Collection col) Returns a type-safe generic collection of the given un-typed collection.static final <T> Enumeration<T>cast(Enumeration en) Returns a type-safe generic enumeration of the given un-typed enumeration.static final <T> Iterator<T>Returns a type-safe generic iterator of the given un-typed iterator.static final <T> List<T>Returns a type-safe generic list of the given un-typed list.static final <T> ListIterator<T>cast(ListIterator it) Returns a type-safe generic list iterator of the given un-typed list iterator.static final <K,V> Map<K, V> Returns a type-safe generic map of the given un-typed map.static final <T> Set<T>Returns a type-safe generic set of the given un-typed set.
-
Constructor Details
-
Generics
public Generics()
-
-
Method Details
-
cast
Returns a type-safe generic class of the given type-less class. -
cast
Force to cast an object to the given type. Notice that it is not safe to use, unless you are sure thatois an instance of T. -
cast
Returns a type-safe generic iterator of the given un-typed iterator. -
cast
Returns a type-safe generic list iterator of the given un-typed list iterator. -
cast
Returns a type-safe generic enumeration of the given un-typed enumeration. -
cast
Returns a type-safe generic collection of the given un-typed collection. -
cast
Returns a type-safe generic list of the given un-typed list. -
cast
Returns a type-safe generic set of the given un-typed set. -
cast
Returns a type-safe generic map of the given un-typed map. -
cast
Returns a type-safe generic thread-local of the given un-typed thread-local.
-