private static OutputHandler createBeanOutputHandler ( AbstractXmlInputOutputHandler inputHandler , String className ) { OutputHandler result = null ; Constructor constructor = null ; try { Class clazz = Class . forName ( className ) ; Class outputClass = inputHandler . getOutputType ( ) ; AssertUtils . assertNotNull ( outputClass , "Since output handler was used which handles Beans - Bean.class should be set via constructor of XmlInputOutputHandler" ) ; constructor = clazz . getConstructor ( Class . class ) ; result = ( OutputHandler ) constructor . newInstance ( outputClass ) ; } catch ( Exception ex ) { throw new MjdbcRuntimeException ( "Cannot initialize bean output handler: " + className + "\nIf you are trying to use non-standard output handler - please add it to allowed map " + "\nvia getDefaultOutputHandlers of MjdbcConfig class" , ex ) ; } return result ; }
Unlike standard output handlers - beans output handlers require bean type via constructor hence cannot be prototyped . This function is invoked to create new instance of Bean output handler