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

x33g5p2x  于2022-01-25 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(129)

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

NameValuePair介绍

[英]A (name, value) pair. These are used as the contents of an annotation.
[中](名称、值)对。它们被用作注释的内容。

代码示例

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

/**
 * Set an annotation element of this instance.
 * If there is a preexisting element with the same name, it will be
 * replaced by this method.
 *
 * @param element {@code non-null;} the annotation element to be set.
 */
public void set(Element element) {
  if (element == null) {
    throw new NullPointerException("element == null");
  }
  CstString pairName = new CstString(element.getName());
  Constant pairValue = Element.toConstant(element.getValue());
  NameValuePair nameValuePair = new NameValuePair(pairName, pairValue);
  elements.put(element.getName(), nameValuePair);
}

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

/** {@inheritDoc} */
public String toHuman() {
  StringBuilder sb = new StringBuilder();
  sb.append(visibility.toHuman());
  sb.append("-annotation ");
  sb.append(type.toHuman());
  sb.append(" {");
  boolean first = true;
  for (NameValuePair pair : elements.values()) {
    if (first) {
      first = false;
    } else {
      sb.append(", ");
    }
    sb.append(pair.getName().toHuman());
    sb.append(": ");
    sb.append(pair.getValue().toHuman());
  }
  sb.append("}");
  return sb.toString();
}

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

/**
 * Put an element into the set of (name, value) pairs for this instance.
 * If there is a preexisting element with the same name, it will be
 * replaced by this method.
 *
 * @param pair {@code non-null;} the (name, value) pair to place into this instance
 */
public void put(NameValuePair pair) {
  throwIfImmutable();
  if (pair == null) {
    throw new NullPointerException("pair == null");
  }
  elements.put(pair.getName(), pair);
}

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

/** {@inheritDoc} */
public int compareTo(Annotation other) {
  int result = type.compareTo(other.type);
  if (result != 0) {
    return result;
  }
  result = visibility.compareTo(other.visibility);
  if (result != 0) {
    return result;
  }
  Iterator<NameValuePair> thisIter = elements.values().iterator();
  Iterator<NameValuePair> otherIter = other.elements.values().iterator();
  while (thisIter.hasNext() && otherIter.hasNext()) {
    NameValuePair thisOne = thisIter.next();
    NameValuePair otherOne = otherIter.next();
    result = thisOne.compareTo(otherOne);
    if (result != 0) {
      return result;
    }
  }
  if (thisIter.hasNext()) {
    return 1;
  } else if (otherIter.hasNext()) {
    return -1;
  }
  return 0;
}

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

/** {@inheritDoc} */
@Override
public String toHuman() {
  StringBuilder sb = new StringBuilder();
  sb.append(visibility.toHuman());
  sb.append("-annotation ");
  sb.append(type.toHuman());
  sb.append(" {");
  boolean first = true;
  for (NameValuePair pair : elements.values()) {
    if (first) {
      first = false;
    } else {
      sb.append(", ");
    }
    sb.append(pair.getName().toHuman());
    sb.append(": ");
    sb.append(pair.getValue().toHuman());
  }
  sb.append("}");
  return sb.toString();
}

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

/**
 * Put an element into the set of (name, value) pairs for this instance.
 * If there is a preexisting element with the same name, it will be
 * replaced by this method.
 *
 * @param pair {@code non-null;} the (name, value) pair to place into this instance
 */
public void put(NameValuePair pair) {
  throwIfImmutable();
  if (pair == null) {
    throw new NullPointerException("pair == null");
  }
  elements.put(pair.getName(), pair);
}

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

/** {@inheritDoc} */
public int compareTo(Annotation other) {
  int result = type.compareTo(other.type);
  if (result != 0) {
    return result;
  }
  result = visibility.compareTo(other.visibility);
  if (result != 0) {
    return result;
  }
  Iterator<NameValuePair> thisIter = elements.values().iterator();
  Iterator<NameValuePair> otherIter = other.elements.values().iterator();
  while (thisIter.hasNext() && otherIter.hasNext()) {
    NameValuePair thisOne = thisIter.next();
    NameValuePair otherOne = otherIter.next();
    result = thisOne.compareTo(otherOne);
    if (result != 0) {
      return result;
    }
  }
  if (thisIter.hasNext()) {
    return 1;
  } else if (otherIter.hasNext()) {
    return -1;
  }
  return 0;
}

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

/** {@inheritDoc} */
public String toHuman() {
  StringBuilder sb = new StringBuilder();
  sb.append(visibility.toHuman());
  sb.append("-annotation ");
  sb.append(type.toHuman());
  sb.append(" {");
  boolean first = true;
  for (NameValuePair pair : elements.values()) {
    if (first) {
      first = false;
    } else {
      sb.append(", ");
    }
    sb.append(pair.getName().toHuman());
    sb.append(": ");
    sb.append(pair.getValue().toHuman());
  }
  sb.append("}");
  return sb.toString();
}

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

/**
 * Put an element into the set of (name, value) pairs for this instance.
 * If there is a preexisting element with the same name, it will be
 * replaced by this method.
 *
 * @param pair {@code non-null;} the (name, value) pair to place into this instance
 */
public void put(NameValuePair pair) {
  throwIfImmutable();
  if (pair == null) {
    throw new NullPointerException("pair == null");
  }
  elements.put(pair.getName(), pair);
}

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

/** {@inheritDoc} */
@Override
public int compareTo(Annotation other) {
  int result = type.compareTo(other.type);
  if (result != 0) {
    return result;
  }
  result = visibility.compareTo(other.visibility);
  if (result != 0) {
    return result;
  }
  Iterator<NameValuePair> thisIter = elements.values().iterator();
  Iterator<NameValuePair> otherIter = other.elements.values().iterator();
  while (thisIter.hasNext() && otherIter.hasNext()) {
    NameValuePair thisOne = thisIter.next();
    NameValuePair otherOne = otherIter.next();
    result = thisOne.compareTo(otherOne);
    if (result != 0) {
      return result;
    }
  }
  if (thisIter.hasNext()) {
    return 1;
  } else if (otherIter.hasNext()) {
    return -1;
  }
  return 0;
}

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

/** {@inheritDoc} */
public String toHuman() {
  StringBuilder sb = new StringBuilder();
  sb.append(visibility.toHuman());
  sb.append("-annotation ");
  sb.append(type.toHuman());
  sb.append(" {");
  boolean first = true;
  for (NameValuePair pair : elements.values()) {
    if (first) {
      first = false;
    } else {
      sb.append(", ");
    }
    sb.append(pair.getName().toHuman());
    sb.append(": ");
    sb.append(pair.getValue().toHuman());
  }
  sb.append("}");
  return sb.toString();
}

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

/**
 * 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_STRING, method));
  result.setImmutable();
  return result;
}

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

/**
 * Put an element into the set of (name, value) pairs for this instance.
 * If there is a preexisting element with the same name, it will be
 * replaced by this method.
 *
 * @param pair {@code non-null;} the (name, value) pair to place into this instance
 */
public void put(NameValuePair pair) {
  throwIfImmutable();
  if (pair == null) {
    throw new NullPointerException("pair == null");
  }
  elements.put(pair.getName(), pair);
}

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

/** {@inheritDoc} */
@Override
public int compareTo(Annotation other) {
  int result = type.compareTo(other.type);
  if (result != 0) {
    return result;
  }
  result = visibility.compareTo(other.visibility);
  if (result != 0) {
    return result;
  }
  Iterator<NameValuePair> thisIter = elements.values().iterator();
  Iterator<NameValuePair> otherIter = other.elements.values().iterator();
  while (thisIter.hasNext() && otherIter.hasNext()) {
    NameValuePair thisOne = thisIter.next();
    NameValuePair otherOne = otherIter.next();
    result = thisOne.compareTo(otherOne);
    if (result != 0) {
      return result;
    }
  }
  if (thisIter.hasNext()) {
    return 1;
  } else if (otherIter.hasNext()) {
    return -1;
  }
  return 0;
}

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

/** {@inheritDoc} */
public String toHuman() {
  StringBuilder sb = new StringBuilder();
  sb.append(visibility.toHuman());
  sb.append("-annotation ");
  sb.append(type.toHuman());
  sb.append(" {");
  boolean first = true;
  for (NameValuePair pair : elements.values()) {
    if (first) {
      first = false;
    } else {
      sb.append(", ");
    }
    sb.append(pair.getName().toHuman());
    sb.append(": ");
    sb.append(pair.getValue().toHuman());
  }
  sb.append("}");
  return sb.toString();
}

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

/**
 * 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: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Put an element into the set of (name, value) pairs for this instance.
 * If there is a preexisting element with the same name, it will be
 * replaced by this method.
 *
 * @param pair {@code non-null;} the (name, value) pair to place into this instance
 */
public void put(NameValuePair pair) {
  throwIfImmutable();
  if (pair == null) {
    throw new NullPointerException("pair == null");
  }
  elements.put(pair.getName(), pair);
}

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

/** {@inheritDoc} */
public int compareTo(Annotation other) {
  int result = type.compareTo(other.type);
  if (result != 0) {
    return result;
  }
  result = visibility.compareTo(other.visibility);
  if (result != 0) {
    return result;
  }
  Iterator<NameValuePair> thisIter = elements.values().iterator();
  Iterator<NameValuePair> otherIter = other.elements.values().iterator();
  while (thisIter.hasNext() && otherIter.hasNext()) {
    NameValuePair thisOne = thisIter.next();
    NameValuePair otherOne = otherIter.next();
    result = thisOne.compareTo(otherOne);
    if (result != 0) {
      return result;
    }
  }
  if (thisIter.hasNext()) {
    return 1;
  } else if (otherIter.hasNext()) {
    return -1;
  }
  return 0;
}

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

/** {@inheritDoc} */
public String toHuman() {
  StringBuilder sb = new StringBuilder();
  sb.append(visibility.toHuman());
  sb.append("-annotation ");
  sb.append(type.toHuman());
  sb.append(" {");
  boolean first = true;
  for (NameValuePair pair : elements.values()) {
    if (first) {
      first = false;
    } else {
      sb.append(", ");
    }
    sb.append(pair.getName().toHuman());
    sb.append(": ");
    sb.append(pair.getValue().toHuman());
  }
  sb.append("}");
  return sb.toString();
}

相关文章

微信公众号

最新文章

更多