当前位置: 首页>>代码示例>>Java>>正文


Java Annotation类代码示例

本文整理汇总了Java中org.jf.dexlib2.iface.Annotation的典型用法代码示例。如果您正苦于以下问题:Java Annotation类的具体用法?Java Annotation怎么用?Java Annotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Annotation类属于org.jf.dexlib2.iface包,在下文中一共展示了Annotation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeTo

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
public static void writeTo(@Nonnull IndentingWriter writer,
                           @Nonnull Collection<? extends Annotation> annotations,
                           @Nullable String containingClass, MethodReplaceAnnotation methodReplaceAnnotation) throws IOException {
    boolean first = true;
    for (Annotation annotation : annotations) {
        if (!first) {
            writer.write('\n');
        }
        first = false;

        writeTo(writer, annotation, containingClass);
    }
    if (null != methodReplaceAnnotation) {
        writeTo(writer, methodReplaceAnnotation, containingClass);
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:17,代码来源:AnnotationFormatter.java

示例2: ImmutableClassDef

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
public ImmutableClassDef(@Nonnull String type,
                         int accessFlags,
                         @Nullable String superclass,
                         @Nullable Collection<String> interfaces,
                         @Nullable String sourceFile,
                         @Nullable Collection<? extends Annotation> annotations,
                         @Nullable Iterable<? extends Field> fields,
                         @Nullable Iterable<? extends Method> methods) {
    if (fields == null) {
        fields = ImmutableList.of();
    }
    if (methods == null) {
        methods = ImmutableList.of();
    }

    this.type = type;
    this.accessFlags = accessFlags;
    this.superclass = superclass;
    this.interfaces = interfaces==null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(interfaces);
    this.sourceFile = sourceFile;
    this.annotations = ImmutableAnnotation.immutableSetOf(annotations);
    this.staticFields = ImmutableField.immutableSetOf(Iterables.filter(fields, FieldUtil.FIELD_IS_STATIC));
    this.instanceFields = ImmutableField.immutableSetOf(Iterables.filter(fields, FieldUtil.FIELD_IS_INSTANCE));
    this.directMethods = ImmutableMethod.immutableSetOf(Iterables.filter(methods, MethodUtil.METHOD_IS_DIRECT));
    this.virtualMethods = ImmutableMethod.immutableSetOf(Iterables.filter(methods, MethodUtil.METHOD_IS_VIRTUAL));
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:ImmutableClassDef.java

示例3: internAnnotationSet

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
@Nonnull public BuilderAnnotationSet internAnnotationSet(@Nullable Set<? extends Annotation> annotations) {
    if (annotations == null) {
        return BuilderAnnotationSet.EMPTY;
    }

    BuilderAnnotationSet ret = internedItems.get(annotations);
    if (ret != null) {
        return ret;
    }

    BuilderAnnotationSet annotationSet = new BuilderAnnotationSet(
            ImmutableSet.copyOf(Iterators.transform(annotations.iterator(),
                    new Function<Annotation, BuilderAnnotation>() {
                        @Nullable @Override public BuilderAnnotation apply(Annotation input) {
                            return context.annotationPool.internAnnotation(input);
                        }
                    })));

    ret = internedItems.putIfAbsent(annotationSet, annotationSet);
    return ret==null?annotationSet:ret;
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:22,代码来源:BuilderAnnotationSetPool.java

示例4: internMethod

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
@Nonnull public BuilderMethod internMethod(@Nonnull String definingClass,
                                           @Nonnull String name,
                                           @Nullable List<? extends MethodParameter> parameters,
                                           @Nonnull String returnType,
                                           int accessFlags,
                                           @Nonnull Set<? extends Annotation> annotations,
                                           @Nullable MethodImplementation methodImplementation) {
    if (parameters == null) {
        parameters = ImmutableList.of();
    }
    return new BuilderMethod(context.methodPool.internMethod(definingClass, name, parameters, returnType),
            internMethodParameters(parameters),
            accessFlags,
            context.annotationSetPool.internAnnotationSet(annotations),
            methodImplementation);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:17,代码来源:DexBuilder.java

示例5: getParameters

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
@Nonnull @Override public List<? extends MethodParameter> getParameters() {
    final Constructor method = this.constructor;
    return new AbstractList<MethodParameter>() {
        private final Class[] parameters = method.getParameterTypes();

        @Override public MethodParameter get(final int index) {
            return new BaseMethodParameter() {
                @Nonnull @Override public Set<? extends Annotation> getAnnotations() {
                    return ImmutableSet.of();
                }

                @Nullable @Override public String getName() {
                    return null;
                }

                @Nonnull @Override public String getType() {
                    return ReflectionUtils.javaToDexName(parameters[index].getName());
                }
            };
        }

        @Override public int size() {
            return parameters.length;
        }
    };
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:ReflectionConstructor.java

示例6: getParameters

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
@Nonnull @Override public List<? extends MethodParameter> getParameters() {
    final java.lang.reflect.Method method = this.method;
    return new AbstractList<MethodParameter>() {
        private final Class[] parameters = method.getParameterTypes();

        @Override public MethodParameter get(final int index) {
            return new BaseMethodParameter() {
                @Nonnull @Override public Set<? extends Annotation> getAnnotations() {
                    return ImmutableSet.of();
                }

                @Nullable @Override public String getName() {
                    return null;
                }

                @Nonnull @Override public String getType() {
                    return ReflectionUtils.javaToDexName(parameters[index].getName());
                }
            };
        }

        @Override public int size() {
            return parameters.length;
        }
    };
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:ReflectionMethod.java

示例7: next

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
@Override public MethodParameter next() {
    @Nonnull final String type = parameterTypes.next().toString();
    @Nonnull final Set<? extends Annotation> annotations;
    @Nullable final String name;

    if (parameterAnnotations.hasNext()) {
        annotations = parameterAnnotations.next();
    } else {
        annotations = ImmutableSet.of();
    }

    if (parameterNames.hasNext()) {
        name = parameterNames.next();
    } else {
        name = null;
    }

    return new BaseMethodParameter() {
        @Nonnull @Override public Set<? extends Annotation> getAnnotations() { return annotations; }
        @Nullable @Override public String getName() { return name; }
        @Nonnull @Override public String getType() { return type; }
    };
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:24,代码来源:ParameterIterator.java

示例8: ImmutableClassDef

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
public ImmutableClassDef(@Nonnull String type,
                         int accessFlags,
                         @Nullable String superclass,
                         @Nullable Collection<String> interfaces,
                         @Nullable String sourceFile,
                         @Nullable Collection<? extends Annotation> annotations,
                         @Nullable Iterable<? extends Field> staticFields,
                         @Nullable Iterable<? extends Field> instanceFields,
                         @Nullable Iterable<? extends Method> directMethods,
                         @Nullable Iterable<? extends Method> virtualMethods) {
    this.type = type;
    this.accessFlags = accessFlags;
    this.superclass = superclass;
    this.interfaces = interfaces==null ? ImmutableList.<String>of() : ImmutableList.copyOf(interfaces);
    this.sourceFile = sourceFile;
    this.annotations = ImmutableAnnotation.immutableSetOf(annotations);
    this.staticFields = ImmutableField.immutableSetOf(staticFields);
    this.instanceFields = ImmutableField.immutableSetOf(instanceFields);
    this.directMethods = ImmutableMethod.immutableSetOf(directMethods);
    this.virtualMethods = ImmutableMethod.immutableSetOf(virtualMethods);
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:22,代码来源:ImmutableClassDef.java

示例9: buildMethodParameterAnnotations

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
private Set<Annotation> buildMethodParameterAnnotations(SootMethod m,
		final int paramIdx) {
	Set<String> skipList = new HashSet<String>();
	Set<Annotation> annotations = buildCommonAnnotations(m, skipList);
	
	for (Tag t : m.getTags()) {
        if (t.getName().equals("VisibilityParameterAnnotationTag")) {
            VisibilityParameterAnnotationTag vat = (VisibilityParameterAnnotationTag)t;
            List<ImmutableAnnotation> visibilityItems = buildVisibilityParameterAnnotationTag
            		(vat, skipList, paramIdx);
        	annotations.addAll(visibilityItems);
        }
	}
	
	return annotations;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:17,代码来源:DexPrinter.java

示例10: ImmutableClassDef

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
public ImmutableClassDef( String type,
                         int accessFlags,
                          String superclass,
                          Collection<String> interfaces,
                          String sourceFile,
                          Collection<? extends Annotation> annotations,
                          Iterable<? extends Field> fields,
                          Iterable<? extends Method> methods) {
    if (fields == null) {
        fields = ImmutableList.of();
    }
    if (methods == null) {
        methods = ImmutableList.of();
    }

    this.type = type;
    this.accessFlags = accessFlags;
    this.superclass = superclass;
    this.interfaces = interfaces==null ? ImmutableList.<String>of() : ImmutableList.copyOf(interfaces);
    this.sourceFile = sourceFile;
    this.annotations = ImmutableAnnotation.immutableSetOf(annotations);
    this.staticFields = ImmutableField.immutableSetOf(Iterables.filter(fields, FieldUtil.FIELD_IS_STATIC));
    this.instanceFields = ImmutableField.immutableSetOf(Iterables.filter(fields, FieldUtil.FIELD_IS_INSTANCE));
    this.directMethods = ImmutableMethod.immutableSetOf(Iterables.filter(methods, MethodUtil.METHOD_IS_DIRECT));
    this.virtualMethods = ImmutableMethod.immutableSetOf(Iterables.filter(methods, MethodUtil.METHOD_IS_VIRTUAL));
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:27,代码来源:ImmutableClassDef.java

示例11: internAnnotationSet

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
public BuilderAnnotationSet internAnnotationSet( Set<? extends Annotation> annotations) {
    if (annotations == null) {
        return BuilderAnnotationSet.EMPTY;
    }

    BuilderAnnotationSet ret = internedItems.get(annotations);
    if (ret != null) {
        return ret;
    }

    BuilderAnnotationSet annotationSet = new BuilderAnnotationSet(
            ImmutableSet.copyOf(Iterators.transform(annotations.iterator(),
                    new Function<Annotation, BuilderAnnotation>() {
                         @Override public BuilderAnnotation apply(Annotation input) {
                            return dexBuilder.annotationSection.internAnnotation(input);
                        }
                    })));

    ret = internedItems.putIfAbsent(annotationSet, annotationSet);
    return ret==null?annotationSet:ret;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:22,代码来源:BuilderAnnotationSetPool.java

示例12: internMethod

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
public BuilderMethod internMethod( String definingClass,
                                            String name,
                                            List<? extends MethodParameter> parameters,
                                            String returnType,
                                           int accessFlags,
                                            Set<? extends Annotation> annotations,
                                            MethodImplementation methodImplementation) {
    if (parameters == null) {
        parameters = ImmutableList.of();
    }
    return new BuilderMethod(methodSection.internMethod(definingClass, name, parameters, returnType),
            internMethodParameters(parameters),
            accessFlags,
            annotationSetSection.internAnnotationSet(annotations),
            methodImplementation);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:DexBuilder.java

示例13: getParameters

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
@Override public List<? extends MethodParameter> getParameters() {
    final java.lang.reflect.Method method = this.method;
    return new AbstractList<MethodParameter>() {
        private final Class[] parameters = method.getParameterTypes();

        @Override public MethodParameter get(final int index) {
            return new BaseMethodParameter() {
                 @Override public Set<? extends Annotation> getAnnotations() {
                    return ImmutableSet.of();
                }

                 @Override public String getName() {
                    return null;
                }

                 @Override public String getType() {
                    return ReflectionUtils.javaToDexName(parameters[index].getName());
                }
            };
        }

        @Override public int size() {
            return parameters.length;
        }
    };
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:27,代码来源:ReflectionMethod.java

示例14: next

import org.jf.dexlib2.iface.Annotation; //导入依赖的package包/类
@Override public MethodParameter next() {
     final String type = parameterTypes.next().toString();
     final Set<? extends Annotation> annotations;
     final String name;

    if (parameterAnnotations.hasNext()) {
        annotations = parameterAnnotations.next();
    } else {
        annotations = ImmutableSet.of();
    }

    if (parameterNames.hasNext()) {
        name = parameterNames.next();
    } else {
        name = null;
    }

    return new BaseMethodParameter() {
         @Override public Set<? extends Annotation> getAnnotations() { return annotations; }
         @Override public String getName() { return name; }
         @Override public String getType() { return type; }
    };
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:24,代码来源:ParameterIterator.java

示例15: 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);
}
 
开发者ID:dodola,项目名称:SimpleSmali,代码行数:13,代码来源:BackSmaliMain.java


注:本文中的org.jf.dexlib2.iface.Annotation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。