Exemplo n.º 1
0
  /**
   * Parses an annotation element
   *
   * @param elementDoc
   * @return
   */
  protected static AnnotationElement ParseAnnotationElement(AnnotationTypeElementDoc elementDoc) {
    // AnnotationTypeElementDoc's are basically methods.

    AnnotationElement element = new AnnotationElement();
    element.name = elementDoc.name();
    AnnotationValue value = elementDoc.defaultValue();
    if (value != null) {
      element.defaultValue = value.toString();
    }
    element.qualifiedName = elementDoc.qualifiedName();
    element.type = elementDoc.returnType().qualifiedTypeName();

    return element;
  }
Exemplo n.º 2
0
 private String getValue(AnnotationMirror am) {
   Map<? extends ExecutableElement, ? extends AnnotationValue> map = am.getElementValues();
   if (map.size() != 1) throw new IllegalArgumentException();
   AnnotationValue v = map.values().iterator().next();
   return (String) v.getValue();
 }