Package com.bacoder.parser.java.api

Examples of com.bacoder.parser.java.api.Annotation


    super(adapters);
  }

  @Override
  public Annotation adapt(AnnotationContext context) {
    Annotation annotation = createNode(context);

    AnnotationNameContext annotationNameContext = getChild(context, AnnotationNameContext.class);
    if (annotationNameContext != null) {
      QualifiedNameContext qualifiedNameContext =
          getChild(annotationNameContext, QualifiedNameContext.class);
      if (qualifiedNameContext != null) {
        annotation.setName(getAdapter(QualifiedNameAdapter.class).adapt(qualifiedNameContext));
      }
    }

    ElementValuePairsContext elementValuePairsContext =
        getChild(context, ElementValuePairsContext.class);
    if (elementValuePairsContext != null) {
      List<NameValuePair> elementValuePairs =
          transform(elementValuePairsContext, ElementValuePairContext.class,
              new Function<ElementValuePairContext, NameValuePair>() {
                @Override
                public NameValuePair apply(ElementValuePairContext context) {
                  return getAdapter(ElementValuePairAdapter.class).adapt(context);
                }
              });
      annotation.setValues(elementValuePairs);
    }

    ElementValueContext elementValueContext = getChild(context, ElementValueContext.class);
    if (elementValueContext != null) {
      AnnotationValue elementValue =
          getAdapter(ElementValueAdapter.class).adapt(elementValueContext);
      annotation.setValue(elementValue);
    }

    return annotation;
  }
View Full Code Here

TOP

Related Classes of com.bacoder.parser.java.api.Annotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.