com.android.dx.rop.annotation.Annotation类的使用及代码示例

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

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

Annotation介绍

[英]An annotation on an element of a class. Annotations have an associated type and additionally consist of a set of (name, value) pairs, where the names are unique.
[中]类元素上的注释。注释具有关联的类型,另外还包含一组(名称、值)对,其中名称是唯一的。

代码示例

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

/**
 * Constructs a standard {@code SourceDebugExtension} annotation.
 *
 * @param smapString {@code non-null;} the SMAP string associated with
 * @return {@code non-null;} the annotation
 */
public static Annotation makeSourceDebugExtension(CstString smapString) {
  Annotation result = new Annotation(SOURCE_DEBUG_EXTENSION_TYPE, SYSTEM);
  result.put(new NameValuePair(VALUE_STRING, smapString));
  result.setImmutable();
  return result;
}

代码示例来源:origin: linkedin/dexmaker

Annotation annotation = new Annotation(cstType, AnnotationVisibility.RUNTIME);
  annotation.add(nvp);

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

/** {@inheritDoc} */
@Override
protected int compareTo0(OffsettedItem other) {
  AnnotationItem otherAnnotation = (AnnotationItem) other;
  return annotation.compareTo(otherAnnotation.annotation);
}

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

int sz = methods.size();
Annotation result =
  new Annotation(thisClass, AnnotationVisibility.EMBEDDED);
boolean any = false;
        one.getNat().getName(),
        oneDefault.getValue());
    result.add(pair);
    any = true;
result.setImmutable();
return AnnotationUtils.makeAnnotationDefault(result);

代码示例来源: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: 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: nikita36078/J2ME-Loader

/** {@inheritDoc} */
@Override
public int hashCode() {
  return annotation.hashCode();
}

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

/** {@inheritDoc} */
@Override
public boolean equals(Object other) {
  if (! (other instanceof CstAnnotation)) {
    return false;
  }
  return annotation.equals(((CstAnnotation) other).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

protected void writeTo0(DexFile file, AnnotatedOutput out) {
  boolean annotates = out.annotates();
  AnnotationVisibility visibility = annotation.getVisibility();

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

int sz = methods.size();
Annotation result =
  new Annotation(thisClass, AnnotationVisibility.EMBEDDED);
boolean any = false;
        one.getNat().getName(),
        oneDefault.getValue());
    result.add(pair);
    any = true;
result.setImmutable();
return AnnotationUtils.makeAnnotationDefault(result);

代码示例来源: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: 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: com.google.android.tools/dx

/** {@inheritDoc} */
@Override
public int hashCode() {
  return annotation.hashCode();
}

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

/** {@inheritDoc} */
@Override
public boolean equals(Object other) {
  if (! (other instanceof CstAnnotation)) {
    return false;
  }
  return annotation.equals(((CstAnnotation) other).annotation);
}

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

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

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

protected void writeTo0(DexFile file, AnnotatedOutput out) {
  boolean annotates = out.annotates();
  AnnotationVisibility visibility = annotation.getVisibility();

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

/**
 * Constructs a standard {@code EnclosingMethod} annotation.
 * 
 * @param method {@code non-null;} the enclosing method
 * @return {@code non-null;} the annotation
 */
public static Annotation makeEnclosingMethod(CstMethodRef method) {
  Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM);
  result.put(new NameValuePair(VALUE_UTF, method));
  result.setImmutable();
  return result;
}

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

int sz = methods.size();
Annotation result =
  new Annotation(thisClass, AnnotationVisibility.EMBEDDED);
boolean any = false;
        one.getNat().getName(),
        oneDefault.getValue());
    result.add(pair);
    any = true;
result.setImmutable();
return AnnotationUtils.makeAnnotationDefault(result);

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

相关文章