Ejemplo n.º 1
0
  /**
   * Adds an annotation. If there is an annotation with the same type, it is removed before the new
   * annotation is added.
   *
   * @param annotation the added annotation.
   */
  public void addAnnotation(Annotation annotation) {
    String type = annotation.getTypeName();
    Annotation[] annotations = getAnnotations();
    for (int i = 0; i < annotations.length; i++) {
      if (annotations[i].getTypeName().equals(type)) {
        annotations[i] = annotation;
        setAnnotations(annotations);
        return;
      }
    }

    Annotation[] newlist = new Annotation[annotations.length + 1];
    System.arraycopy(annotations, 0, newlist, 0, annotations.length);
    newlist[annotations.length] = annotation;
    setAnnotations(newlist);
  }
Ejemplo n.º 2
0
 int memberValuePair(int pos, int nameIndex) throws Exception {
   pos = super.memberValuePair(pos, nameIndex);
   currentAnno.addMemberValue(nameIndex, currentMember);
   return pos;
 }