本文整理匯總了Java中org.apache.bcel.classfile.JavaClass.getPackageName方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaClass.getPackageName方法的具體用法?Java JavaClass.getPackageName怎麽用?Java JavaClass.getPackageName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.bcel.classfile.JavaClass
的用法示例。
在下文中一共展示了JavaClass.getPackageName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visit
import org.apache.bcel.classfile.JavaClass; //導入方法依賴的package包/類
public void visit(JavaClass obj) {
try {
methodMap.clear();
badOverrideMap.clear();
JavaClass superClass = obj.getSuperClass();
if (superClass == null) return;
String packageName = superClass.getPackageName();
String className = superClass.getClassName();
isAdapter = ((className.endsWith("Adapter")) && (packageName.equals("java.awt.event") || packageName.equals("javax.swing.event")));
if (isAdapter) {
Method[] methods = superClass.getMethods();
for (int i = 0; i < methods.length; i++) {
methodMap.put(methods[i].getName(), methods[i].getSignature());
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
}
示例2: scanFields
import org.apache.bcel.classfile.JavaClass; //導入方法依賴的package包/類
private void scanFields(JavaClass jclass, Set<XField> assignableFieldSet) {
JavaClass myClass = classContext.getJavaClass();
String myClassName = myClass.getClassName();
String myPackageName = myClass.getPackageName();
String superClassName = jclass.getClassName();
String superPackageName = jclass.getPackageName();
Field[] fieldList = jclass.getFields();
for (int i = 0; i < fieldList.length; ++i) {
Field field = fieldList[i];
if (field.isStatic())
continue;
boolean assignable = false;
if (field.isPublic() || field.isProtected())
assignable = true;
else if (field.isPrivate())
assignable = myClassName.equals(superClassName);
else // package protected
assignable = myPackageName.equals(superPackageName);
if (assignable) {
assignableFieldSet.add(new InstanceField(superClassName, field.getName(), field.getSignature(),
field.getAccessFlags()));
}
}
}