protected static void checkObject ( Context context , String name , Object object , Class clazz ) throws Exception { Class objectClass = object . getClass ( ) ; if ( clazz . isAssignableFrom ( objectClass ) == false ) { StringBuffer buffer = new StringBuffer ( 100 ) ; buffer . append ( "Object at '" ) . append ( name ) ; buffer . append ( "' in context " ) . append ( context . getEnvironment ( ) ) ; buffer . append ( " is not an instance of " ) ; appendClassInfo ( buffer , clazz ) ; buffer . append ( " object class is " ) ; appendClassInfo ( buffer , object . getClass ( ) ) ; throw new ClassCastException ( buffer . toString ( ) ) ; } }
Checks an object implements the given class