private static String handleFileField ( String property , CtClass clazz ) throws NotFoundException , CannotCompileException { String wrapperName = property + "wrapper" ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( createTrace ( String . format ( "Handle File type property '%s'" , property ) ) ) . append ( String . format ( "if(%s == null) {" , property ) ) . append ( String . format ( "elements.add(new OpenEngSBModelEntry(\"%s\"" , wrapperName ) ) . append ( ", null, FileWrapper.class));}\n else {" ) . append ( String . format ( "FileWrapper %s = new FileWrapper(%s);\n" , wrapperName , property ) ) . append ( String . format ( "%s.serialize();\n" , wrapperName ) ) . append ( String . format ( "elements.add(new OpenEngSBModelEntry(\"%s\",%s,%s.getClass()));}\n" , wrapperName , wrapperName , wrapperName ) ) ; addFileFunction ( clazz , property ) ; return builder . toString ( ) ; }
Creates the logic which is needed to handle fields which are File types since they need special treatment .