// static factory

// old way without generics
public static SomeInterface someFactory( Class classDesired )
   {
   SomeInterface t;
   //...
   return t;
   }

Thing thing = (Thing) someFactory( Thing.class );

// new way with generics
public static <T extends SomeInterface> T someFactory( Class<T> classDesired )
   {
   T t;
   //...
   return t;
   }

Thing thing = someFactory( Thing.class );