public static < T > T instantiateUserCode ( TaskConfig config , ClassLoader cl , Class < ? super T > superClass ) { try { T stub = config . < T > getStubWrapper ( cl ) . getUserCodeObject ( superClass , cl ) ; // check if the class is a subclass, if the check is required if ( superClass != null && ! superClass . isAssignableFrom ( stub . getClass ( ) ) ) { throw new RuntimeException ( "The class '" + stub . getClass ( ) . getName ( ) + "' is not a subclass of '" + superClass . getName ( ) + "' as is required." ) ; } return stub ; } catch ( ClassCastException ccex ) { throw new RuntimeException ( "The UDF class is not a proper subclass of " + superClass . getName ( ) , ccex ) ; } }
Instantiates a user code class from is definition in the task configuration . The class is instantiated without arguments using the null - ary constructor . Instantiation will fail if this constructor does not exist or is not public .