Class Generics


  • public class Generics
    extends Object
    Helpermethods, that simplify working with generics.
    • Constructor Detail

      • Generics

        public Generics()
    • 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