Class has a method called cast but that will only make sense if you know the Class type. For instance, with a Class<Hobby> object "cls", cls.cast(x) will either return x cast to Hobby or throw an exception.