com.android.dx.rop.annotation.Annotations.getAnnotations()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.android.dx.rop.annotation.Annotations.getAnnotations()方法的一些代码示例,展示了Annotations.getAnnotations()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotations.getAnnotations()方法的具体详情如下:
包路径:com.android.dx.rop.annotation.Annotations
类名称:Annotations
方法名:getAnnotations

Annotations.getAnnotations介绍

[英]Gets the set of annotations contained in this instance. The result is always unmodifiable.
[中]获取此实例中包含的批注集。结果总是不可更改的。

代码示例

代码示例来源:origin: com.google.dexmaker/dexmaker-dx

/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 */
public AnnotationSetItem(Annotations annotations) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a);
    at++;
  }
}

代码示例来源:origin: gdpancheng/LoonAndroid3

/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 */
public AnnotationSetItem(Annotations annotations) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a);
    at++;
  }
}

代码示例来源:origin: nikita36078/J2ME-Loader

/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 * @param dexFile {@code non-null;} dex output
 */
public AnnotationSetItem(Annotations annotations, DexFile dexFile) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a, dexFile);
    at++;
  }
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 * @param dexFile {@code non-null;} dex output
 */
public AnnotationSetItem(Annotations annotations, DexFile dexFile) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a, dexFile);
    at++;
  }
}

代码示例来源:origin: com.google.android.tools/dx

/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 */
public AnnotationSetItem(Annotations annotations) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a);
    at++;
  }
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Constructs an instance.
 * 
 * @param annotations {@code non-null;} set of annotations
 */
public AnnotationSetItem(Annotations annotations) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a);
    at++;
  }
}

代码示例来源:origin: com.android/dx

/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 * @param dexFile {@code non-null;} dex output
 */
public AnnotationSetItem(Annotations annotations, DexFile dexFile) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a, dexFile);
    at++;
  }
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 * @param dexFile {@code non-null;} dex output
 */
public AnnotationSetItem(Annotations annotations, DexFile dexFile) {
  super(ALIGNMENT, writeSize(annotations));
  this.annotations = annotations;
  this.items = new AnnotationItem[annotations.size()];
  int at = 0;
  for (Annotation a : annotations.getAnnotations()) {
    items[at] = new AnnotationItem(a, dexFile);
    at++;
  }
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Inspects a class annotation.
 *
 * @param cf {@code non-null;} class file
 * @param ann {@code non-null;} annotation
 */
private void visitClassAnnotation(DirectClassFile cf,
    BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.TYPE)) {
    return;
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatch(cf);
    }
  }
}

代码示例来源:origin: com.google.android.tools/dx

/**
 * Inspects a class annotation.
 *
 * @param cf {@code non-null;} class file
 * @param ann {@code non-null;} annotation
 */
private void visitClassAnnotation(DirectClassFile cf,
    BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.TYPE)) {
    return;
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatch(cf);
    }
  }
}

代码示例来源:origin: com.android/dx

/**
 * Inspects a class annotation.
 *
 * @param cf {@code non-null;} class file
 * @param ann {@code non-null;} annotation
 */
private void visitClassAnnotation(DirectClassFile cf,
    BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.TYPE)) {
    return;
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatch(cf);
    }
  }
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Inspects a class annotation.
 *
 * @param cf {@code non-null;} class file
 * @param ann {@code non-null;} annotation
 */
private void visitClassAnnotation(DirectClassFile cf,
    BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.TYPE)) {
    return;
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatch(cf);
    }
  }
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Inspects a class annotation.
 *
 * @param cf {@code non-null;} class file
 * @param ann {@code non-null;} annotation
 */
private void visitClassAnnotation(DirectClassFile cf,
    BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.TYPE)) {
    return;
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatch(cf);
    }
  }
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

for (Annotation a : methodAnnotations.getAnnotations()) {
  pw.println("    " + a);
  pw.println("    parameter " + i);
  Annotations annotations = parameterAnnotations.get(i);
  for (Annotation a : annotations.getAnnotations()) {
    pw.println("      " + a);

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Inspects a package annotation
 *
 * @param cf {@code non-null;} class file of "package-info" pseudo-class
 * @param ann {@code non-null;} annotation
 */
private void visitPackageAnnotation(
    DirectClassFile cf, BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.PACKAGE)) {
    return;
  }
  String packageName = cf.getThisClass().getClassType().getClassName();
  int slashIndex = packageName.lastIndexOf('/');
  if (slashIndex == -1) {
    packageName = "";
  } else {
    packageName
        = packageName.substring(0, slashIndex);
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatchPackage(packageName);
    }
  }
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Inspects a package annotation
 *
 * @param cf {@code non-null;} class file of "package-info" pseudo-class
 * @param ann {@code non-null;} annotation
 */
private void visitPackageAnnotation(
    DirectClassFile cf, BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.PACKAGE)) {
    return;
  }
  String packageName = cf.getThisClass().getClassType().getClassName();
  int slashIndex = packageName.lastIndexOf('/');
  if (slashIndex == -1) {
    packageName = "";
  } else {
    packageName
        = packageName.substring(0, slashIndex);
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatchPackage(packageName);
    }
  }
}

代码示例来源:origin: com.google.android.tools/dx

/**
 * Inspects a package annotation
 *
 * @param cf {@code non-null;} class file of "package-info" pseudo-class
 * @param ann {@code non-null;} annotation
 */
private void visitPackageAnnotation(
    DirectClassFile cf, BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.PACKAGE)) {
    return;
  }
  String packageName = cf.getThisClass().getClassType().getClassName();
  int slashIndex = packageName.lastIndexOf('/');
  if (slashIndex == -1) {
    packageName = "";
  } else {
    packageName
        = packageName.substring(0, slashIndex);
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatchPackage(packageName);
    }
  }
}

代码示例来源:origin: com.android/dx

/**
 * Inspects a package annotation
 *
 * @param cf {@code non-null;} class file of "package-info" pseudo-class
 * @param ann {@code non-null;} annotation
 */
private void visitPackageAnnotation(
    DirectClassFile cf, BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.PACKAGE)) {
    return;
  }
  String packageName = cf.getThisClass().getClassType().getClassName();
  int slashIndex = packageName.lastIndexOf('/');
  if (slashIndex == -1) {
    packageName = "";
  } else {
    packageName
        = packageName.substring(0, slashIndex);
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatchPackage(packageName);
    }
  }
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Inspects a package annotation
 *
 * @param cf {@code non-null;} class file of "package-info" pseudo-class
 * @param ann {@code non-null;} annotation
 */
private void visitPackageAnnotation(
    DirectClassFile cf, BaseAnnotations ann) {
  if (!args.eTypes.contains(ElementType.PACKAGE)) {
    return;
  }
  String packageName = cf.getThisClass().getClassType().getClassName();
  int slashIndex = packageName.lastIndexOf('/');
  if (slashIndex == -1) {
    packageName = "";
  } else {
    packageName
        = packageName.substring(0, slashIndex);
  }
  for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
    String annClassName
        = anAnn.getType().getClassType().getClassName();
    if (args.aclass.equals(annClassName)) {
      printMatchPackage(packageName);
    }
  }
}

代码示例来源:origin: dragome/dragome-sdk

private static Annotation getAnnotation(AttributeList attrs, Class<?> annotationClazz)
{
  BaseAnnotations a= (BaseAnnotations) attrs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME);
  if (a != null)
  {
    String annotationName= getClassWithSlashes(annotationClazz);
    for (Annotation an : a.getAnnotations().getAnnotations())
    {
      if (an.getType().getClassType().getClassName().equals(annotationName))
      {
        return an;
      }
    }
  }
  return null;
}

相关文章