本文整理汇总了Java中org.jf.dexlib2.iface.Annotation.getElements方法的典型用法代码示例。如果您正苦于以下问题:Java Annotation.getElements方法的具体用法?Java Annotation.getElements怎么用?Java Annotation.getElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jf.dexlib2.iface.Annotation
的用法示例。
在下文中一共展示了Annotation.getElements方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: annotionToString
import org.jf.dexlib2.iface.Annotation; //导入方法依赖的package包/类
private static void annotionToString(Writer printStream, Annotation annotation, Indentation indent)
throws IOException {
List<String> attributes = new ArrayList<String>();
Set<? extends AnnotationElement> elements = annotation.getElements();
for (AnnotationElement element : elements) {
attributes.add(String
.format("%s=%s", element.getName(), DexEncodedValueUtils.getEncodeValue(element.getValue())));
}
printStream.write(indent.toString());
printStream.write(String.format("@%s(%s)", annotation.getType(), String.join(",", attributes)));
printStream.write(newLine);
}
示例2: getMethodAnnotaionPrepareClasses
import org.jf.dexlib2.iface.Annotation; //导入方法依赖的package包/类
public static void getMethodAnnotaionPrepareClasses(DexDiffInfo dexDiffInfo, Set<String> prepareclasses){
for (DexBackedMethod method:dexDiffInfo.getModifiedMethods()){
Set<? extends Annotation>annotations = method.getAnnotations();
if (annotations == null){
continue;
}
for (Annotation annotation:annotations){
String type = annotation.getType();
if (type!= null&&type.startsWith("L")&&type.endsWith(";")){
prepareclasses.add(type.substring(1, type.length() - 1).replace('/', '.'));
System.out.println("prepare class: " + type);
}
Set<? extends AnnotationElement> elements = annotation.getElements();
for (AnnotationElement dexBackedAnnotationElement:elements){
if (dexBackedAnnotationElement.getValue() instanceof DexBackedArrayEncodedValue){
List<? extends EncodedValue> values = ((DexBackedArrayEncodedValue) dexBackedAnnotationElement.getValue()).getValue();
for (EncodedValue encodedValue:values) {
if (encodedValue instanceof TypeEncodedValue) {
prepareclasses.add(((TypeEncodedValue) encodedValue).getValue().substring(1, ((TypeEncodedValue) encodedValue).getValue().length() - 1).replace('/', '.'));
System.out.println("prepare class: " + ((TypeEncodedValue) encodedValue).getValue());
}
}
}else if (dexBackedAnnotationElement.getValue() instanceof DexBackedTypeEncodedValue){
String value = ((DexBackedTypeEncodedValue) dexBackedAnnotationElement.getValue()).getValue();
prepareclasses.add(value.substring(1, value.length() - 1).replace('/', '.'));
System.out.println("prepare class: " + value);
}
}
}
}
}
示例3: of
import org.jf.dexlib2.iface.Annotation; //导入方法依赖的package包/类
public static ImmutableAnnotation of(Annotation annotation) {
if (annotation instanceof ImmutableAnnotation) {
return (ImmutableAnnotation)annotation;
}
return new ImmutableAnnotation(
annotation.getVisibility(),
annotation.getType(),
annotation.getElements());
}
示例4: intern
import org.jf.dexlib2.iface.Annotation; //导入方法依赖的package包/类
public void intern(@Nonnull Annotation annotation) {
Integer prev = internedItems.put(annotation, 0);
if (prev == null) {
typePool.intern(annotation.getType());
for (AnnotationElement element: annotation.getElements()) {
stringPool.intern(element.getName());
DexPool.internEncodedValue(element.getValue(), stringPool, typePool, fieldPool, methodPool);
}
}
}
示例5: intern
import org.jf.dexlib2.iface.Annotation; //导入方法依赖的package包/类
public void intern( Annotation annotation) {
Integer prev = internedItems.put(annotation, 0);
if (prev == null) {
dexPool.typeSection.intern(annotation.getType());
for (AnnotationElement element: annotation.getElements()) {
dexPool.stringSection.intern(element.getName());
dexPool.internEncodedValue(element.getValue());
}
}
}
示例6: getElements
import org.jf.dexlib2.iface.Annotation; //导入方法依赖的package包/类
@Nonnull @Override public Collection<? extends AnnotationElement> getElements(@Nonnull Annotation annotation) {
return annotation.getElements();
}
示例7: getElements
import org.jf.dexlib2.iface.Annotation; //导入方法依赖的package包/类
@Override public Collection<? extends AnnotationElement> getElements( Annotation annotation) {
return annotation.getElements();
}