本文整理汇总了Java中org.apache.bcel.classfile.AnnotationEntry.getAnnotationType方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationEntry.getAnnotationType方法的具体用法?Java AnnotationEntry.getAnnotationType怎么用?Java AnnotationEntry.getAnnotationType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.AnnotationEntry
的用法示例。
在下文中一共展示了AnnotationEntry.getAnnotationType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAnnotations
import org.apache.bcel.classfile.AnnotationEntry; //导入方法依赖的package包/类
private void addAnnotations(Element node, AnnotationEntry[] annotations) {
if (annotations.length == 0) {
return;
}
Element a = new Element("annotations", nsXMLVM);
node.addContent(a);
for (AnnotationEntry annotation : annotations) {
String type = annotation.getAnnotationType();
// Turn into a scoped name. Strip off leading "L" and
// trailing
// ";"
type = type.substring(1, type.length() - 1);
type = type.replaceAll("/", ".");
Element newAnnotation = new Element("annotation", nsXMLVM);
a.addContent(newAnnotation);
newAnnotation.setAttribute("type", type);
ElementValuePair[] values = annotation.getElementValuePairs();
for (ElementValuePair value : values) {
Element property = new Element("property", nsXMLVM);
// TODO(arno) Need to add type
property.setAttribute("name", value.getNameString());
property.setAttribute("value", value.getValue().stringifyValue());
newAnnotation.addContent(property);
}
}
}
示例2: visitMethod
import org.apache.bcel.classfile.AnnotationEntry; //导入方法依赖的package包/类
@Override
public void visitMethod(Method obj) {
super.visitMethod(obj);
if (obj.isPrivate() && !getMethodName().equals("writeReplace") && !getMethodName().equals("readResolve")
&& !getMethodName().equals("readObject") && !getMethodName().equals("readObjectNoData")
&& !getMethodName().equals("writeObject") && getMethodName().indexOf("debug") == -1
&& getMethodName().indexOf("Debug") == -1 && getMethodName().indexOf("trace") == -1
&& getMethodName().indexOf("Trace") == -1 && !getMethodName().equals("<init>")
&& !getMethodName().equals("<clinit>")) {
for(AnnotationEntry a : obj.getAnnotationEntries()) {
String typeName = a.getAnnotationType();
if (typeName.equals("Ljavax/annotation/PostConstruct;")
|| typeName.equals("Ljavax/annotation/PreDestroy;"))
return;
}
definedPrivateMethods.add(MethodAnnotation.fromVisitedMethod(this));
}
}
示例3: getClassAnnotationAttribute
import org.apache.bcel.classfile.AnnotationEntry; //导入方法依赖的package包/类
@Override
public String getClassAnnotationAttribute(String annotation, String attribute) {
for (AnnotationEntry annotationEntry : javaClass.getAnnotationEntries()) {
String annotationType = annotationEntry.getAnnotationType();
if(removePackageDefinition(annotationType, PACKAGE_SLASH_SEPARATOR, removeSemicolon).equals(annotation)) {
return getAttribute(annotationEntry, attribute);
}
}
return "";
}
示例4: hasClassAnnotation
import org.apache.bcel.classfile.AnnotationEntry; //导入方法依赖的package包/类
public boolean hasClassAnnotation(String annotation) {
for (AnnotationEntry annotationEntry : javaClass.getAnnotationEntries()) {
String annotationType = annotationEntry.getAnnotationType();
if(removePackageDefinition(annotationType, PACKAGE_SLASH_SEPARATOR, removeSemicolon).equals(annotation)) {
return true;
}
}
return false;
}
示例5: getAnnotationMap
import org.apache.bcel.classfile.AnnotationEntry; //导入方法依赖的package包/类
private Map<String, Map<String, String>> getAnnotationMap(AnnotationEntry[] annotationEntries) {
Map<String, Map<String, String>> annotationMap = new HashMap<String, Map<String, String>>();
for (AnnotationEntry annotationEntry : annotationEntries) {
String annotationType = annotationEntry.getAnnotationType();
annotationMap.put(removePackageDefinition(annotationType, PACKAGE_SLASH_SEPARATOR, removeSemicolon), getAnnotationAttributesMap(annotationEntry));
}
return annotationMap;
}
示例6: visitMethod
import org.apache.bcel.classfile.AnnotationEntry; //导入方法依赖的package包/类
@Override
public void visitMethod(Method method) {
xmlMethod = new Element("method", nsXMLVM);
xmlMethod.setAttribute("name", method.getName());
addAccessModifiers(xmlMethod, method.getAccessFlags());
if (!method.isAbstract() && !method.isNative()) {
// Abstract methods don't have an implementation
Code code = method.getCode();
String maxStack = java.lang.String.valueOf(code.getMaxStack());
String maxLocals = java.lang.String.valueOf(code.getMaxLocals());
xmlMethod.setAttribute("stack", maxStack);
xmlMethod.setAttribute("locals", maxLocals);
}
Element sgn = parseSignature(method.getSignature());
xmlMethod.addContent(sgn);
// TODO(arno) this should also be handled via the <annotations>
// tag.
// Need modification in xmlvm2js.xsl
// Look for NativeInterface annotation
for (AnnotationEntry annotation : method.getAnnotationEntries()) {
String type = annotation.getAnnotationType();
if (type.equals("Lorg/xmlvm/NativeInterface;")) {
ElementValuePair[] value = annotation.getElementValuePairs();
String nativeMethodName = value[0].getValue().toString();
xmlMethod.setAttribute("nativeInterface", nativeMethodName);
break;
}
}
addAnnotations(xmlMethod, method.getAnnotationEntries());
xmlClass.addContent(xmlMethod);
this.bcelMethod = method;
}