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

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

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

Annotation.getType介绍

[英]Gets the type of this instance.
[中]获取此实例的类型。

代码示例

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

/**
 * Adds an element to this instance. There must not already be an
 * element of the same type.
 *
 * @param annotation {@code non-null;} the element to add
 * @throws IllegalArgumentException thrown if there is a duplicate type
 */
public void add(Annotation annotation) {
  throwIfImmutable();
  if (annotation == null) {
    throw new NullPointerException("annotation == null");
  }
  CstType type = annotation.getType();
  if (annotations.containsKey(type)) {
    throw new IllegalArgumentException("duplicate type: " +
        type.toHuman());
  }
  annotations.put(type, annotation);
}

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

/** {@inheritDoc} */
@Override
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

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

/** {@inheritDoc} */
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

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

/** {@inheritDoc} */
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

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

/** {@inheritDoc} */
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

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

/** {@inheritDoc} */
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

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

/** {@inheritDoc} */
@Override
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

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

/** {@inheritDoc} */
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

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

/** {@inheritDoc} */
public void addContents(DexFile file) {
  type = file.getTypeIds().intern(annotation.getType());
  ValueEncoder.addContents(file, annotation);
}

代码示例来源: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: 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;
}

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

/**
 * Helper for {@code addContents()} methods, which adds
 * contents for a particular {@link Annotation}, calling itself
 * recursively should it encounter a nested annotation.
 *
 * @param file {@code non-null;} the file to add to
 * @param annotation {@code non-null;} the annotation to add contents for
 */
public static void addContents(DexFile file, Annotation annotation) {
  TypeIdsSection typeIds = file.getTypeIds();
  StringIdsSection stringIds = file.getStringIds();
  typeIds.intern(annotation.getType());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    stringIds.intern(pair.getName());
    addContents(file, pair.getValue());
  }
}

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

/**
 * Helper for {@code addContents()} methods, which adds
 * contents for a particular {@link Annotation}, calling itself
 * recursively should it encounter a nested annotation.
 *
 * @param file {@code non-null;} the file to add to
 * @param annotation {@code non-null;} the annotation to add contents for
 */
public static void addContents(DexFile file, Annotation annotation) {
  TypeIdsSection typeIds = file.getTypeIds();
  StringIdsSection stringIds = file.getStringIds();
  typeIds.intern(annotation.getType());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    stringIds.intern(pair.getName());
    addContents(file, pair.getValue());
  }
}

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

/**
 * Helper for {@code addContents()} methods, which adds
 * contents for a particular {@link Annotation}, calling itself
 * recursively should it encounter a nested annotation.
 *
 * @param file {@code non-null;} the file to add to 
 * @param annotation {@code non-null;} the annotation to add contents for
 */
public static void addContents(DexFile file, Annotation annotation) {
  TypeIdsSection typeIds = file.getTypeIds();
  StringIdsSection stringIds = file.getStringIds();
  typeIds.intern(annotation.getType());
  
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    stringIds.intern(pair.getName());
    addContents(file, pair.getValue());
  }
}

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

/**
 * Helper for {@code addContents()} methods, which adds
 * contents for a particular {@link Annotation}, calling itself
 * recursively should it encounter a nested annotation.
 *
 * @param file {@code non-null;} the file to add to
 * @param annotation {@code non-null;} the annotation to add contents for
 */
public static void addContents(DexFile file, Annotation annotation) {
  TypeIdsSection typeIds = file.getTypeIds();
  StringIdsSection stringIds = file.getStringIds();
  typeIds.intern(annotation.getType());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    stringIds.intern(pair.getName());
    addContents(file, pair.getValue());
  }
}

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

/**
 * Helper for {@code addContents()} methods, which adds
 * contents for a particular {@link Annotation}, calling itself
 * recursively should it encounter a nested annotation.
 *
 * @param file {@code non-null;} the file to add to
 * @param annotation {@code non-null;} the annotation to add contents for
 */
public static void addContents(DexFile file, Annotation annotation) {
  TypeIdsSection typeIds = file.getTypeIds();
  StringIdsSection stringIds = file.getStringIds();
  typeIds.intern(annotation.getType());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    stringIds.intern(pair.getName());
    addContents(file, pair.getValue());
  }
}

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

/**
 * Write a (listing file) annotation for this instance to the given
 * output, that consumes no bytes of output. This is for annotating
 * a reference to this instance at the point of the reference.
 *
 * @param out {@code non-null;} where to output to
 * @param prefix {@code non-null;} prefix for each line of output
 */
public void annotateTo(AnnotatedOutput out, String prefix) {
  out.annotate(0, prefix + "visibility: " +
      annotation.getVisibility().toHuman());
  out.annotate(0, prefix + "type: " + annotation.getType().toHuman());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    CstString name = pair.getName();
    Constant value = pair.getValue();
    out.annotate(0, prefix + name.toHuman() + ": " +
        ValueEncoder.constantToHuman(value));
  }
}

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

/**
 * Write a (listing file) annotation for this instance to the given
 * output, that consumes no bytes of output. This is for annotating
 * a reference to this instance at the point of the reference.
 *
 * @param out {@code non-null;} where to output to
 * @param prefix {@code non-null;} prefix for each line of output
 */
public void annotateTo(AnnotatedOutput out, String prefix) {
  out.annotate(0, prefix + "visibility: " +
      annotation.getVisibility().toHuman());
  out.annotate(0, prefix + "type: " + annotation.getType().toHuman());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    CstString name = pair.getName();
    Constant value = pair.getValue();
    out.annotate(0, prefix + name.toHuman() + ": " +
        ValueEncoder.constantToHuman(value));
  }
}

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

/**
 * Write a (listing file) annotation for this instance to the given
 * output, that consumes no bytes of output. This is for annotating
 * a reference to this instance at the point of the reference.
 *
 * @param out {@code non-null;} where to output to
 * @param prefix {@code non-null;} prefix for each line of output
 */
public void annotateTo(AnnotatedOutput out, String prefix) {
  out.annotate(0, prefix + "visibility: " +
      annotation.getVisibility().toHuman());
  out.annotate(0, prefix + "type: " + annotation.getType().toHuman());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    CstString name = pair.getName();
    Constant value = pair.getValue();
    out.annotate(0, prefix + name.toHuman() + ": " +
        ValueEncoder.constantToHuman(value));
  }
}

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

/**
 * Write a (listing file) annotation for this instance to the given
 * output, that consumes no bytes of output. This is for annotating
 * a reference to this instance at the point of the reference.
 *
 * @param out {@code non-null;} where to output to
 * @param prefix {@code non-null;} prefix for each line of output
 */
public void annotateTo(AnnotatedOutput out, String prefix) {
  out.annotate(0, prefix + "visibility: " +
      annotation.getVisibility().toHuman());
  out.annotate(0, prefix + "type: " + annotation.getType().toHuman());
  for (NameValuePair pair : annotation.getNameValuePairs()) {
    CstString name = pair.getName();
    Constant value = pair.getValue();
    out.annotate(0, prefix + name.toHuman() + ": " +
        ValueEncoder.constantToHuman(value));
  }
}

相关文章