public static <T>T assertAndCast(Class<? extends T> clazz,Object o){
  assertNotNull(clazz);
  assertNotNull(o);
  assertTrue(clazz.isInstance(o));
  return clazz.cast(o);
}

public static < T > T assertAndCast ( Class < ? extends T > clazz , Object o ) { assertNotNull ( clazz ) ; assertNotNull ( o ) ; assertTrue ( clazz . isInstance ( o ) ) ; return clazz . cast ( o ) ; }
given a type and an object asserts that the object is non - null and an instance of the specified type . the object is then cast to that type and returned .
