/** * 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); }
/** {@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(); }
/** * 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); }
/** {@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; }
/** {@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(); }
/** * 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); }
/** {@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; }
/** {@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(); }
/** * 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; }
/** * 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); }
/** {@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; }
/** {@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(); }
/** * 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; }
/** * 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); }
/** {@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; }
/** {@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(); }
/** * 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; }
/** * 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); }
/** {@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; }
/** {@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(); }