private static < T > T cast ( Class < T > clazz , Object o ) { if ( ! clazz . isInstance ( o ) ) throw new IllegalArgumentException ( o . toString ( ) ) ; return clazz . cast ( o ) ; }
Returns an object cast to the specified type .