Package de.galan.commons.util
Class Generics
- java.lang.Object
-
- de.galan.commons.util.Generics
-
public class Generics extends Object
Helpermethods, that simplify working with generics.
-
-
Constructor Summary
Constructors Constructor Description Generics()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Tcast(Object x)Casts an object by type inference.static <T> Class<T>getClass(T t)Returns the generic Class object for a given argument.
-
-
-
Method Detail
-
cast
public static <T> T cast(Object x)
Casts an object by type inference. see also http://weblogs.java.net/blog/emcmanus/archive/2007/03/getting_rid_of.html- Parameters:
x- Object that will be casted
-
getClass
public static <T> Class<T> getClass(T t)
Returns the generic Class object for a given argument.- Type Parameters:
T- Type the argument returns- Parameters:
t- object to check
-
-