Package com.sun.javadoc

Examples of com.sun.javadoc.AnnotationDesc


        }
    }

    private void loadEvents()
    {
        AnnotationDesc eventsAnnotation = getAnnotation(classDoc, Events.class);

        if (eventsAnnotation == null)
            return;

        // Events has only a single attribute: value(), so we know its the first element
        // in the array.

        ElementValuePair pair = eventsAnnotation.elementValues()[0];

        AnnotationValue annotationValue = pair.value();
        AnnotationValue[] values = (AnnotationValue[]) annotationValue.value();

        for (AnnotationValue eventValue : values)
View Full Code Here


        return null;
    }

    private static Map<String, String> getAnnotationValues(ProgramElementDoc source, Class annotationType)
    {
        AnnotationDesc annotation = getAnnotation(source, annotationType);

        if (annotation == null)
            return null;

        Map<String, String> result = CollectionFactory.newMap();

        for (ElementValuePair pair : annotation.elementValues())
        {
            result.put(pair.element().name(), pair.value().value().toString());
        }

        return result;
View Full Code Here

  public AnnotationParser(Parameter parameter) {
    this.annotations = parameter.annotations();
  }

  public String getAnnotationValue(String qualifiedAnnotationType, String key) {
    AnnotationDesc annotation = getAnnotation(qualifiedAnnotationType);
    if (annotation == null) {
      return null;
    }
    for (AnnotationDesc.ElementValuePair evp : annotation.elementValues()) {
      if (evp.element().name().equals(key)) {
        String val = evp.value().value().toString();
        return val.trim();
      }
    }
View Full Code Here

   * @param qualifiedAnnotationType The FQN of the annotation
   * @param key The field name of the annotation to get
   * @return The values or null if none were found
   */
  public ClassDoc[] getAnnotationClassDocValues(String qualifiedAnnotationType, String key) {
    AnnotationDesc annotation = getAnnotation(qualifiedAnnotationType);
    if (annotation == null) {
      return null;
    }
    for (AnnotationDesc.ElementValuePair evp : annotation.elementValues()) {
      if (evp.element().name().equals(key)) {
        Object val = evp.value().value();
        AnnotationValue[] vals = (AnnotationValue[]) val;
        if (vals != null && vals.length > 0) {
          ClassDoc[] res = new ClassDoc[vals.length];
View Full Code Here

   * @param qualifiedAnnotationType The FQN of the annotation
   * @param key The field name of the annotation to get
   * @return The values or null if none were found
   */
  public String[] getAnnotationValues(String qualifiedAnnotationType, String key) {
    AnnotationDesc annotation = getAnnotation(qualifiedAnnotationType);
    if (annotation == null) {
      return null;
    }
    for (AnnotationDesc.ElementValuePair evp : annotation.elementValues()) {
      if (evp.element().name().equals(key)) {
        Object val = evp.value().value();
        AnnotationValue[] vals = (AnnotationValue[]) val;
        if (vals != null && vals.length > 0) {
          String[] res = new String[vals.length];
View Full Code Here

  public boolean isAnnotatedBy(String qualifiedAnnotationType) {
    return getAnnotation(qualifiedAnnotationType) != null;
  }

  private AnnotationDesc getAnnotation(String qualifiedAnnotationType) {
    AnnotationDesc found = null;
    for (AnnotationDesc annotation : this.annotations) {
      try {
        if (annotation.annotationType().qualifiedTypeName().equals(qualifiedAnnotationType)) {
          found = annotation;
          break;
View Full Code Here

    * @return the annotation the argument is annotated with or
    *         <code>null</code> if the annotation is not found.
    */
   public static AnnotationDesc annotation(final Parameter param,
                                           final Class<?> type) {
      AnnotationDesc result = null;
      for (final AnnotationDesc annotation : annotations(param)) {
         final String name = annotation.annotationType().qualifiedName();
         if (StringUtils.equals(type.getName(), name)) {
            result = annotation;
            break;
View Full Code Here

    * @return the annotation the element is annotated with or <code>null</code>
    *         if the annotation is not found.
    */
   public static AnnotationDesc annotation(final ProgramElementDoc element,
                                           final Class<?> type) {
      AnnotationDesc result = null;
      for (final AnnotationDesc annotation : annotations(element)) {
         final String name = annotation.annotationType().qualifiedName();
         if (StringUtils.equals(type.getName(), name)) {
            result = annotation;
            break;
View Full Code Here

    public AnnotationParser(Parameter parameter) {
        annotations = parameter.annotations();
    }

    public String getAnnotationValue(String qualifiedAnnotationType, String key) {
        AnnotationDesc annotation = getAnnotation(qualifiedAnnotationType);
        if (annotation == null) {
            return null;
        }
        for (AnnotationDesc.ElementValuePair evp : annotation.elementValues()) {
            if (evp.element().name().equals(key)) {
                return evp.value().value().toString();
            }
        }
        return null;
View Full Code Here

    public boolean isAnnotatedBy(String qualifiedAnnotationType) {
        return getAnnotation(qualifiedAnnotationType) != null;
    }

    private AnnotationDesc getAnnotation(String qualifiedAnnotationType) {
        AnnotationDesc found = null;
        for (AnnotationDesc annotation : annotations) {
            try {
                if (annotation.annotationType().qualifiedTypeName().equals(qualifiedAnnotationType)) {
                    found = annotation;
                    break;
View Full Code Here

TOP

Related Classes of com.sun.javadoc.AnnotationDesc

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.