public void finish ( ) throws IOException { //Map<String,Set<TypeLibInfo>> byPackage = new HashMap<String,Set<TypeLibInfo>>(); //for( TypeLibInfo tli : generatedTypeLibs ) { // Set<TypeLibInfo> s = byPackage.get(tli.packageName); // if(s==null) // byPackage.put(tli.packageName,s=new HashSet<TypeLibInfo>()); // s.add(tli); //} // for( Map.Entry<String,Set<TypeLibInfo>> e : byPackage.entrySet() ) { for ( Package pkg : packages . values ( ) ) { LibBinder lib1 = pkg . typeLibs . iterator ( ) . next ( ) ; if ( referenceResolver . suppress ( lib1 . lib ) ) continue ; // generate ClassFactory IndentingWriter o = pkg . createWriter ( lib1 , "ClassFactory.java" ) ; lib1 . generateHeader ( o ) ; o . printJavadoc ( "Defines methods to create COM objects" ) ; o . println ( "public abstract class ClassFactory {" ) ; o . in ( ) ; o . println ( "private ClassFactory() {} // instanciation is not allowed" ) ; o . println ( ) ; for ( LibBinder lib : pkg . typeLibs ) { int len = lib . lib . count ( ) ; for ( int i = 0 ; i < len ; i ++ ) { ICoClassDecl t = lib . lib . getType ( i ) . queryInterface ( ICoClassDecl . class ) ; if ( t == null ) continue ; if ( ! t . isCreatable ( ) ) continue ; declareFactoryMethod ( o , t ) ; t . dispose ( ) ; } } o . out ( ) ; o . println ( "}" ) ; o . close ( ) ; } }
Finally call this method to wrap things up .