public static void main(String[] args) throws IOException { Project project = new Project(); InputStream in = WASManagedRuntime.class.getClassLoader() .getResourceAsStream(CLASS.replace('.', '/') + ".class"); BCClass bcClass = project.loadClass(in); String [] interfaces = bcClass.getInterfaceNames(); if(interfaces != null) { for(int i = 0; i < interfaces.length; i++) { if(interfaces[i].equals(INTERFACE)) { return; } } } bcClass.declareInterface(INTERFACE); AsmAdaptor.write(bcClass); }
public static void main(String[] args) throws IOException { Project project = new Project(); InputStream in = WASManagedRuntime.class.getClassLoader() .getResourceAsStream(CLASS.replace('.', '/') + ".class"); BCClass bcClass = project.loadClass(in); String [] interfaces = bcClass.getInterfaceNames(); if(interfaces != null) { for(int i = 0; i < interfaces.length; i++) { if(interfaces[i].equals(INTERFACE)) { return; } } } bcClass.declareInterface(INTERFACE); AsmAdaptor.write(bcClass); }
public static void main(String[] args) throws IOException { Project project = new Project(); InputStream in = WASManagedRuntime.class.getClassLoader() .getResourceAsStream(CLASS.replace('.', '/') + ".class"); BCClass bcClass = project.loadClass(in); String [] interfaces = bcClass.getInterfaceNames(); if(interfaces != null) { for(int i = 0; i < interfaces.length; i++) { if(interfaces[i].equals(INTERFACE)) { return; } } } bcClass.declareInterface(INTERFACE); bcClass.write(); }
public static void main(String[] args) throws IOException { Project project = new Project(); InputStream in = WASManagedRuntime.class.getClassLoader() .getResourceAsStream(CLASS.replace('.', '/') + ".class"); BCClass bcClass = project.loadClass(in); String [] interfaces = bcClass.getInterfaceNames(); if(interfaces != null) { for(int i = 0; i < interfaces.length; i++) { if(interfaces[i].equals(INTERFACE)) { return; } } } bcClass.declareInterface(INTERFACE); AsmAdaptor.write(bcClass); }
public static void main(String[] args) throws IOException { Project project = new Project(); InputStream in = WASManagedRuntime.class.getClassLoader() .getResourceAsStream(CLASS.replace('.', '/') + ".class"); BCClass bcClass = project.loadClass(in); String [] interfaces = bcClass.getInterfaceNames(); if(interfaces != null) { for(int i = 0; i < interfaces.length; i++) { if(interfaces[i].equals(INTERFACE)) { return; } } } bcClass.declareInterface(INTERFACE); AsmAdaptor.write(bcClass); }
/** * Return true if this class or any of its superclasses implement/extend * the given interface/class. * This method does not recurse into interfaces-of-interfaces. */ public boolean isInstanceOf(String name) { name = _project.getNameCache().getExternalForm(name, false); String[] interfaces = getInterfaceNames(); for (int i = 0; i < interfaces.length; i++) if (interfaces[i].equals(name)) return true; for (BCClass type = this; type != null; type = type.getSuperclassBC()) if (type.getName().equals(name)) return true; return false; }
/** * Return true if this class or any of its superclasses implement/extend * the given interface/class. * This method does not recurse into interfaces-of-interfaces. */ public boolean isInstanceOf(String name) { name = _project.getNameCache().getExternalForm(name, false); String[] interfaces = getInterfaceNames(); for (int i = 0; i < interfaces.length; i++) if (interfaces[i].equals(name)) return true; for (BCClass type = this; type != null; type = type.getSuperclassBC()) if (type.getName().equals(name)) return true; return false; }