public static void runAllClassesInDex(String jarCanonicalPath) throws Exception { DexFile dexFile = ArchiveReader.get(new File(jarCanonicalPath)); Set<? extends ClassDef> allClassesInDex = dexFile.getClasses(); for (ClassDef currentClass : allClassesInDex) { String normType = DexlibAdapter.getClassStringFromDex(currentClass.getType()); Translator sourceGenerator = TranslatorFactory.createTranslator(normType, new File(jarCanonicalPath)); sourceGenerator.apply(); System.out.println(sourceGenerator.toString()); } }
public static void main(String[] args) { DisplayArea da = new DisplayArea(null); Translator emitter = new Translator2Java(StringTokenizer.class); emitter.apply(); da.displayClass(emitter.getElementsList()); JFrame frame = new JFrame("Test"); frame.getContentPane().add(da.onAddComponentToPane()); frame.pack(); frame.setVisible(true); }
public static void generateStubFile(Translator translator) { FileStubGenerator.generateStubFile(translator.getClassName(), translator.toString()); }