/** * Creates a CtClass object representing the specified class. * It first examines whether or not the corresponding class * file exists. If yes, it creates a CtClass object. * * @return null if the class file could not be found. */ protected CtClass createCtClass(String classname, boolean useCache) { // accept "[L<class name>;" as a class name. if (classname.charAt(0) == '[') classname = Descriptor.toClassName(classname); if (classname.endsWith("[]")) { String base = classname.substring(0, classname.indexOf('[')); if ((!useCache || getCached(base) == null) && find(base) == null) return null; else return new CtArray(classname, this); } else if (find(classname) == null) return null; else return new CtClassType(classname, this); }
public boolean subtypeOf(CtClass clazz) throws NotFoundException { if (super.subtypeOf(clazz)) return true; String cname = clazz.getName(); if (cname.equals(javaLangObject)) return true; CtClass[] intfs = getInterfaces(); for (int i = 0; i < intfs.length; i++) if (intfs[i].subtypeOf(clazz)) return true; return clazz.isArray() && getComponentType().subtypeOf(clazz.getComponentType()); }
public CtClass getComponentType() throws NotFoundException { String name = getName(); return pool.get(name.substring(0, name.length() - 2)); }
public CtMethod getMethod(String name, String desc) throws NotFoundException { return getSuperclass().getMethod(name, desc); }
public int getModifiers() { int mod = Modifier.FINAL; try { mod |= getComponentType().getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC | Modifier.PRIVATE); } catch (NotFoundException e) {} return mod; }
@Override public CtMethod getMethod(String name, String desc) throws NotFoundException { return getSuperclass().getMethod(name, desc); }
@Override public int getModifiers() { int mod = Modifier.FINAL; try { mod |= getComponentType().getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC | Modifier.PRIVATE); } catch (NotFoundException e) {} return mod; }
public CtConstructor[] getConstructors() { try { return getSuperclass().getConstructors(); } catch (NotFoundException e) { return super.getConstructors(); } } }
@Override public boolean subtypeOf(CtClass clazz) throws NotFoundException { if (super.subtypeOf(clazz)) return true; String cname = clazz.getName(); if (cname.equals(javaLangObject)) return true; CtClass[] intfs = getInterfaces(); for (int i = 0; i < intfs.length; i++) if (intfs[i].subtypeOf(clazz)) return true; return clazz.isArray() && getComponentType().subtypeOf(clazz.getComponentType()); }
public int getModifiers() { int mod = Modifier.FINAL; try { mod |= getComponentType().getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC | Modifier.PRIVATE); } catch (NotFoundException e) {} return mod; }
@Override public CtClass getComponentType() throws NotFoundException { String name = getName(); return pool.get(name.substring(0, name.length() - 2)); }
/** * Creates a CtClass object representing the specified class. * It first examines whether or not the corresponding class * file exists. If yes, it creates a CtClass object. * * @return null if the class file could not be found. */ protected CtClass createCtClass(String classname, boolean useCache) { // accept "[L<class name>;" as a class name. if (classname.charAt(0) == '[') classname = Descriptor.toClassName(classname); if (classname.endsWith("[]")) { String base = classname.substring(0, classname.indexOf('[')); if ((!useCache || getCached(base) == null) && find(base) == null) return null; else return new CtArray(classname, this); } else if (find(classname) == null) return null; else return new CtClassType(classname, this); }
public CtMethod[] getMethods() { try { return getSuperclass().getMethods(); } catch (NotFoundException e) { return super.getMethods(); } }
public boolean subtypeOf(CtClass clazz) throws NotFoundException { if (super.subtypeOf(clazz)) return true; String cname = clazz.getName(); if (cname.equals(javaLangObject)) return true; CtClass[] intfs = getInterfaces(); for (int i = 0; i < intfs.length; i++) if (intfs[i].subtypeOf(clazz)) return true; return clazz.isArray() && getComponentType().subtypeOf(clazz.getComponentType()); }
public int getModifiers() { int mod = Modifier.FINAL; try { mod |= getComponentType().getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC | Modifier.PRIVATE); } catch (NotFoundException e) {} return mod; }
public CtClass getComponentType() throws NotFoundException { String name = getName(); return pool.get(name.substring(0, name.length() - 2)); }
/** * Creates a CtClass object representing the specified class. * It first examines whether or not the corresponding class * file exists. If yes, it creates a CtClass object. * * @return null if the class file could not be found. */ protected CtClass createCtClass(String classname, boolean useCache) { // accept "[L<class name>;" as a class name. if (classname.charAt(0) == '[') classname = Descriptor.toClassName(classname); if (classname.endsWith("[]")) { String base = classname.substring(0, classname.indexOf('[')); if ((!useCache || getCached(base) == null) && find(base) == null) return null; else return new CtArray(classname, this); } else if (find(classname) == null) return null; else return new CtClassType(classname, this); }
@Override public CtConstructor[] getConstructors() { try { return getSuperclass().getConstructors(); } catch (NotFoundException e) { return super.getConstructors(); } } }
public boolean subtypeOf(CtClass clazz) throws NotFoundException { if (super.subtypeOf(clazz)) return true; String cname = clazz.getName(); if (cname.equals(javaLangObject)) return true; CtClass[] intfs = getInterfaces(); for (int i = 0; i < intfs.length; i++) if (intfs[i].subtypeOf(clazz)) return true; return clazz.isArray() && getComponentType().subtypeOf(clazz.getComponentType()); }
public int getModifiers() { int mod = Modifier.FINAL; try { mod |= getComponentType().getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC | Modifier.PRIVATE); } catch (NotFoundException e) {} return mod; }