Package com.sun.javadoc

Examples of com.sun.javadoc.AnnotationValue


        // 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)
        {
            String event = (String) eventValue.value();
            int ws = event.indexOf(' ');
View Full Code Here


    {
      AnnotationDesc.ElementValuePair[] mvps = src.elementValues();
      for(int i=0; i<mvps.length; i++) {
        Type jmt = mvps[i].element().returnType();
        String name = mvps[i].element().name();
        AnnotationValue aval = mvps[i].value();
        setAnnotationValue(name,jmt,aval,dest,sp);
      }
    }
if (!useAnnotationDefaults()) return;
    { // also set values for the type's defaults
      AnnotationTypeDoc atd = src.annotationType();
      AnnotationTypeElementDoc[] elements = atd.elements();
      for(int i=0; i<elements.length; i++) {
        AnnotationValue value = elements[i].defaultValue();
        if (value != null) {
          String name = elements[i].name();
          System.out.println("default value named '"+name+"'  = "+
                             " "+value+"  "+value.getClass()+" "+dest.getValue(name));
          if (dest.getValue(name) == null) {
            setAnnotationValue(name,elements[i].returnType(),
                               value,dest,sp);
          }
        }
View Full Code Here

    for(int i=0; i<values.length; i++) {
      AnnotationTypeElementDoc ated = values[i].element();
      String name = ated.name();
      Object value;
      {
        AnnotationValue avalue = values[i].value();
        if (avalue == null) continue; //REVIEW
        value = avalue.value();
      }
      if (value == null) continue; //REVIEW
      if (value instanceof AnnotationDesc) {
        Class nestedClass = getClassFor((AnnotationDesc)value);
        if (nestedClass == null) continue;
View Full Code Here

    *         found.
    */
   public static AnnotationValue elementValue(final Parameter param,
                                              final Class<?> type,
                                              final String elementName) {
      AnnotationValue value = null;
      final ElementValuePair[] pairs = elementValues(param, type);
      for (final ElementValuePair pair : pairs) {
         if (StringUtils.equals(elementName, pair.element().name())) {
            value = pair.value();
            break;
View Full Code Here

    *         found.
    */
   public static AnnotationValue elementValue(final ProgramElementDoc element,
                                              final Class<?> type,
                                              final String elementName) {
      AnnotationValue value = null;
      final ElementValuePair[] pairs = elementValues(element, type);
      for (ElementValuePair pair : pairs) {
         if (StringUtils.equals(elementName, pair.element().name())) {
            value = pair.value();
            break;
View Full Code Here

    * Initialises the HTTP request-method this method is mapped to.
    *
    * @param methodDoc the method's Java documentation object.
    */
   private void initRequestMethod(Method method, final MethodDoc methodDoc) {
      final AnnotationValue value =
         elementValue(methodDoc, RequestMapping.class, "method");

      LOG.debug(method.getName());

      if (value == null) {
         /* default */
         LOG.debug("No method found.... defaulting to GET");
         method.setRequestMethod(RequestMethod.GET.toString());
      } else {
         /*
          * Java 1.6: AnnotationValue.toString() returns qualified classname
          * example:
          * org.springframework.web.bind.annotation.RequestMethod.GET Java
          * 1.5: AnnotationValue.toString() returns simple classname example:
          * GET
          */
         if (value.toString().contains(".")) {
            method.setRequestMethod(value.toString().substring(
               value.toString().lastIndexOf(".") + 1));
         } else {
            method.setRequestMethod(value.toString());
         }
      }
      LOG.debug(method.getRequestMethod());
   }
View Full Code Here

   }

   private void initProduces(Method method, final MethodDoc methodDoc) {

      final AnnotationValue value =
         elementValue(methodDoc, RequestMapping.class, "produces");

      LOG.debug(method.getName());

      if (value != null) {
         method.setProduces(value.toString().replace("\"", ""));
         LOG.debug("PRODUCES " + method.getProduces());
      }

   }
View Full Code Here

      }

   }

   private void initConsumes(Method method, final MethodDoc methodDoc) {
      final AnnotationValue value =
         elementValue(methodDoc, RequestMapping.class, "consumes");

      LOG.debug(method.getName());

      if (value != null) {
         method.setConsumes(value.toString().replace("\"", ""));
         LOG.debug("CONSUMES " + method.getConsumes());
      }
   }
View Full Code Here

         LOG.debug("CONSUMES " + method.getConsumes());
      }
   }

   private void initHeaders(Method method, final MethodDoc methodDoc) {
      final AnnotationValue value =
         elementValue(methodDoc, RequestMapping.class, "headers");

      LOG.debug(method.getName());

      if (value != null) {
         method.setHeaders(value.toString().replace("\"", ""));
         LOG.debug("HEADERS " + method.getHeaders());
      }
   }
View Full Code Here

            restParams.add(new RestParameter(pair));
         }

      }

      AnnotationValue urlAnnotation =
         elementValue(methodDoc, RequestMapping.class, "value");
      if (urlAnnotation != null) {
         Boolean deprecatedMatch = false;
         String[] methodUris = parseValueAnnotation(urlAnnotation);
         String[] deprecatedURIs = DocTypeUtils.getDeprecatedURIs(methodDoc);
View Full Code Here

TOP

Related Classes of com.sun.javadoc.AnnotationValue

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.