private void importInheritances(DbJVClass dbClaz, JavaClass claz) throws DbException { String qualifiedName = claz.getSuperclassName(); if (!"java.lang.Object".equals(qualifiedName)) { importInheritance(dbClaz, qualifiedName, false); } String[] qualifiedNames = claz.getInterfaceNames(); for (String qn : qualifiedNames) { importInheritance(dbClaz, qn, true); } // end for }
private DbJVClass importClass(JavaClass claz, Controller controller) throws DbException { String packName = claz.getPackageName(); String qualifiedName = claz.getClassName(); int idx = qualifiedName.lastIndexOf('.'); String classname = qualifiedName.substring(idx + 1); DbJVClass dbClaz = null; try { if (m_classModel != null) { DbJVPackage pack = findPackageByName(packName); // create class or interface int value = claz.isInterface() ? JVClassCategory.INTERFACE : JVClassCategory.CLASS; JVClassCategory catg = JVClassCategory.getInstance(value); dbClaz = (pack == null) ? new DbJVClass(this.m_classModel, catg) : new DbJVClass(pack, catg); dbClaz.setName(classname); // set class modifiers dbClaz.setAbstract(claz.isAbstract()); dbClaz.setFinal(claz.isFinal()); dbClaz.setStatic(claz.isStatic()); dbClaz.setStrictfp(claz.isStrictfp()); dbClaz.setVisibility(toVisibility(claz)); // create inheritances importInheritances(dbClaz, claz); // create fields if (m_params.createFields) { Field[] fields = claz.getFields(); for (Field field : fields) { importField(dbClaz, field); } } // create methods if (m_params.createMethods) { Method[] methods = claz.getMethods(); for (Method method : methods) { importMethod(dbClaz, method); } } // keep user informed of progression String pattern = LocaleMgr.misc.getString("0SuccessfullyCreated"); String msg = MessageFormat.format(pattern, qualifiedName); controller.println(msg); } // end if } catch (DbException ex) { controller.println(ex.toString()); } // end try return dbClaz; } // end importClass()