/** * Load the bytecode from the given class file. * If this project already contains the class in the given file, it will * be returned. Otherwise a new {@link BCClass} will be created from the * given bytecode. * * @throws RuntimeException on parse error */ public BCClass loadClass(File classFile) { return loadClass(classFile, null); }
/** * Load the bytecode from the given stream. * If this project already contains the class in the given stream, * it will be returned. Otherwise a new {@link BCClass} will be created * from the given bytecode. * * @throws RuntimeException on parse error */ public BCClass loadClass(InputStream in) { return loadClass(in, null); }
public BCClass run() { return project.loadClass(clazz); } };
/** * Load a class with the given name. * * @see #loadClass(String,ClassLoader) */ public BCClass loadClass(String name) { return loadClass(name, null); }
private BCMethod getBCMethod(Method meth) { BCClass bc = pc.getProject().loadClass(meth.getDeclaringClass()); return bc.getDeclaredMethod(meth.getName(), meth.getParameterTypes()); }
/** * The public constructor is for creating template code modules * that produce {@link Instruction}s used in matching through * the various <code>search</code> and <code>replace</code> methods. */ public Code() { this(0, new Project().loadClass("", null).declareMethod("", void.class, null)); }
/** * Return the bytecode for the type of constant this attribute represents. */ public BCClass getTypeBC() { return getProject().loadClass(getType()); }
/** * Return the bytecode for the type of this field. */ public BCClass getTypeBC() { return getProject().loadClass(getTypeName(), getClassLoader()); }
/** * The bytecode for the type of this annotation. */ public BCClass getTypeBC() { return getProject().loadClass(getTypeName(), getClassLoader()); }
/** * Return the bytecode for all the parameter types for this method. * * @see BCMember#getDescriptor */ public BCClass[] getParamBCs() { String[] paramNames = getParamNames(); BCClass[] params = new BCClass[paramNames.length]; for (int i = 0; i < paramNames.length; i++) params[i] = getProject().loadClass(paramNames[i], getClassLoader()); return params; }
/** * Return the bytecode for all the parameter types for this method. * * @see BCMember#getDescriptor */ public BCClass[] getParamBCs() { String[] paramNames = getParamNames(); BCClass[] params = new BCClass[paramNames.length]; for (int i = 0; i < paramNames.length; i++) params[i] = getProject().loadClass(paramNames[i], getClassLoader()); return params; }
/** * Return the return type of the method this instruction operates on, * or null if not set. */ public BCClass getMethodReturnBC() { String type = getMethodReturnName(); if (type == null) return null; return getProject().loadClass(type, getClassLoader()); }
/** * Return the declaring class of the field this instruction operates on, * or null if not set. */ public BCClass getFieldDeclarerBC() { String type = getFieldDeclarerName(); if (type == null) return null; return getProject().loadClass(type, getClassLoader()); }
/** * Return the type for this instruction. * If the type has not been set or the class is not a member, this method * will return null. */ public BCClass getDeclarerBC() { String type = getDeclarerName(); if (type == null) return null; return getProject().loadClass(type, getClassLoader()); }
/** * Return the bytecode of the superclass of this class, or * null for types without superclasses. */ public BCClass getSuperclassBC() { String name = getSuperclassName(); if (name == null) return null; return getProject().loadClass(name, getClassLoader()); }
/** * Return the bytecode for the type of this field. */ public BCClass getTypeBC() { return getProject().loadClass(getTypeName(), getClassLoader()); }
/** * Return the type for this instruction. * If the type has not been set, this method will return null. */ public BCClass getTypeBC() { String type = getTypeName(); if (type == null) return null; return getProject().loadClass(type, getClassLoader()); }
/** * Return the bytecode of the type being converted from. * If neither type has been set, this method will return null. */ public BCClass getFromTypeBC() { String type = getFromTypeName(); if (type == null) return null; return getProject().loadClass(type, getClassLoader()); }
/** * Return the type of this local. * If the type has not been set, this method will return null. */ public BCClass getTypeBC() { String type = getTypeName(); if (type == null) return null; return getProject().loadClass(type, getClassLoader()); }
/** * Return the param types of the method this instruction operates on, * or empty array if none. */ public BCClass[] getMethodParamBCs() { String[] paramNames = getMethodParamNames(); BCClass[] params = new BCClass[paramNames.length]; for (int i = 0; i < paramNames.length; i++) params[i] = getProject().loadClass(paramNames[i], getClassLoader()); return params; }