Package com.almende.util.AnnotationUtil

Examples of com.almende.util.AnnotationUtil.AnnotatedParam


      } else {
        final ObjectNode paramsObject = (ObjectNode) params;
       
        final Object[] objects = new Object[annotatedParams.size()];
        for (int i = 0; i < annotatedParams.size(); i++) {
          final AnnotatedParam p = annotatedParams.get(i);
         
          final Annotation a = getRequestAnnotation(p, requestParams);
          if (a != null) {
            // this is a systems parameter
            objects[i] = requestParams.get(a);
          } else {
            final String name = getName(p);
            if (name != null) {
              // this is a named parameter
              if (paramsObject.has(name)) {
                objects[i] = TypeUtil.inject(
                    paramsObject.get(name),
                    p.getGenericType());
              } else {
                if (isRequired(p)) {
                  throw new ClassCastException(
                      "Required parameter '" + name
                          + "' missing.");
                } else if (p.getType().isPrimitive()) {
                  // TODO: should this test be moved to
                  // isAvailable()?
                  throw new ClassCastException("Parameter '"
                      + name
                      + "' cannot be both optional and "
                      + "a primitive type ("
                      + p.getType().getSimpleName() + ")");
                } else {
                  objects[i] = null;
                }
              }
            } else {
View Full Code Here


        .getParams();
   
    final ObjectNode params = JOM.createObjectNode();
   
    for (int i = 0; i < annotatedParams.size(); i++) {
      final AnnotatedParam annotatedParam = annotatedParams.get(i);
      if (i < args.length && args[i] != null) {
        final String name = getName(annotatedParam);
        if (name != null) {
          final JsonNode paramValue = JOM.getInstance().valueToTree(args[i]);
          params.put(name, paramValue);
View Full Code Here

TOP

Related Classes of com.almende.util.AnnotationUtil.AnnotatedParam

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.