本文整理汇总了Java中org.apache.bcel.Repository.addClass方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.addClass方法的具体用法?Java Repository.addClass怎么用?Java Repository.addClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.Repository
的用法示例。
在下文中一共展示了Repository.addClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitSet
import org.apache.bcel.Repository; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.bcel.IObjectSetVisitor */
public void visitSet(Set aSet)
{
// register the JavaClasses in the Repository
Repository.clearCache();
Iterator it = aSet.iterator();
while (it.hasNext()) {
final JavaClass javaClass = (JavaClass) it.next();
Repository.addClass(javaClass);
}
// visit the visitors
it = getObjectSetVisitors().iterator();
while (it.hasNext()) {
final IObjectSetVisitor visitor = (IObjectSetVisitor) it.next();
visitor.visitSet(aSet);
}
}
示例2: rewrite
import org.apache.bcel.Repository; //导入方法依赖的package包/类
void rewrite(JavaClass javaClass, SpawnSignature[] spawnSignatures)
throws NoSpawningClassException, ClassRewriteFailure, AssumptionFailure {
String className = javaClass.getClassName();
SpawningClass spawnableClass =
new SpawningClass(javaClass, spawnSignatures, new Debug(d.turnedOn(), 2));
d.log(0, "%s is a spawning class\n", className);
d.log(1, "it contains calls with spawn signatures:\n");
print(spawnableClass.getSpawnSignatures(), 2);
d.log(1, "rewriting %s\n", className);
if (spawnableClass.rewrite(analyzer)) {
Repository.removeClass(javaClass);
javaClass = spawnableClass.getJavaClass();
Repository.addClass(javaClass);
setModified(wrapper.getInfo(javaClass));
}
}
示例3: analyze
import org.apache.bcel.Repository; //导入方法依赖的package包/类
private <T extends IPersistenceDAO> T analyze(Class<T> klass)
throws Exception {
DAOAnalysisSimple analysis = amap.get(klass);
T instance = null;
if (analysis == null) {
analysis = new DAOAnalysisSimple(klass);
analysis.setDebug(true);
amap.put(klass, analysis);
instance = klass.cast(createInstance(analysis));
JavaClass parse =
new ClassParser(analysis.getClassFile(), instance.getClass()
.getCanonicalName()).parse();
Repository.addClass(parse);
// new BCELifier(parse, System.out).start();
// Verifier.main(new String[] { parse.getClassName() });
} else {
instance = klass.cast(createInstance(analysis));
}
return instance;
}
示例4: parse
import org.apache.bcel.Repository; //导入方法依赖的package包/类
/**
* Parse the class file into a JavaClass object.
* If succesful, the new JavaClass is entered into the Repository.
*
* @return the parsed JavaClass
* @throws IOException if the class cannot be parsed
*/
public JavaClass parse() throws IOException {
JavaClass jclass = classParser.parse();
Repository.addClass(jclass);
return jclass;
}
示例5: parse
import org.apache.bcel.Repository; //导入方法依赖的package包/类
/**
* Parse the class file into a JavaClass object. If succesful, the new
* JavaClass is entered into the Repository.
*
* @return the parsed JavaClass
* @throws IOException
* if the class cannot be parsed
*/
public JavaClass parse() throws IOException {
JavaClass jclass = classParser.parse();
Repository.addClass(jclass);
return jclass;
}