本文整理汇总了Java中org.apache.bcel.classfile.Field.getAnnotationEntries方法的典型用法代码示例。如果您正苦于以下问题:Java Field.getAnnotationEntries方法的具体用法?Java Field.getAnnotationEntries怎么用?Java Field.getAnnotationEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.Field
的用法示例。
在下文中一共展示了Field.getAnnotationEntries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzeField
import org.apache.bcel.classfile.Field; //导入方法依赖的package包/类
private void analyzeField(Field field, JavaClass javaClass) {
for (AnnotationEntry annotation : field.getAnnotationEntries()) {
if (ANNOTATION_TYPES.contains(annotation.getAnnotationType()) ||
annotation.getAnnotationType().contains("JsonTypeInfo")) {
for (ElementValuePair elementValuePair : annotation.getElementValuePairs()) {
if ("use".equals((elementValuePair.getNameString())) &&
VULNERABLE_USE_NAMES.contains(elementValuePair.getValue().stringifyValue())) {
bugReporter.reportBug(new BugInstance(this, DESERIALIZATION_TYPE, HIGH_PRIORITY)
.addClass(javaClass)
.addString(javaClass.getClassName() + " on field " +
field.getName() + " of type " + field.getType() +
" annotated with " + annotation.toShortString())
.addField(FieldAnnotation.fromBCELField(javaClass, field))
.addString("")
);
}
}
}
}
}
示例2: getClassField
import org.apache.bcel.classfile.Field; //导入方法依赖的package包/类
private ClassField getClassField(Field field) {
ClassField classField = new ClassField(getType(field), field.getName());
AnnotationEntry[] annotationEntries = field.getAnnotationEntries();
if(annotationEntries.length > 0) {
classField.setAnnotationMap(getAnnotationMap(annotationEntries));
}
return classField;
}
示例3: Attribute
import org.apache.bcel.classfile.Field; //导入方法依赖的package包/类
public Attribute(JavaClass javaClass, Field field, boolean isParseAnnotation) {
this.javaClass = javaClass;
this.javaClassId = javaClass.getId();
this.access_flags = field.getAccessFlags();
this.info = field.toString();
this.name = field.getName();
this.signature = SignatureUtil.getSignature(field);
this.types = new ArrayList<String>();
for (String type : ParseUtil.signatureToTypes(this.signature)) {
this.types.add(type);
}
if (field.isStatic() && field.getConstantValue() != null) {
staticValue = field.getConstantValue().toString();
}
this.annotationRefs = new AnnotationRefs();
// 处理Annotation
if (isParseAnnotation) {
for (AnnotationEntry annotationEntry : field.getAnnotationEntries()) {
if (annotationEntry.getAnnotationType().equals(AnnotationParse.Autowired)) {
this.annotationRefs.setAutowired(AnnotationParse.parseAutowired(annotationEntry));
} else if (annotationEntry.getAnnotationType().equals(AnnotationParse.Qualifier)) {
this.annotationRefs.setQualifier(AnnotationParse.parseQualifier(annotationEntry));
}
}
}
}