Package com.cloudcontrolled.api.client.body

Examples of com.cloudcontrolled.api.client.body.BodyMultivaluedMap


   * @param <T>
   *            a T object.
   * @return a {@link javax.ws.rs.core.MultivaluedMap} object.
   */
  public static <T> MultivaluedMap<String, String> getBodyAsMultiValuedMap(Request<T> request) {
    MultivaluedMap<String, String> map = new BodyMultivaluedMap();

    Class<?> referenceClazz = request.getClass();
    List<Field> fields = ClassUtil.getAnnotatedFields(referenceClazz, Body.class);
    for (Field field : fields) {
      Body body = field.getAnnotation(Body.class);
      String parameter = body.value();

      // in case the value() is null or empty
      if (parameter == null || (parameter != null && parameter.isEmpty())) {
        parameter = field.getName();
      }
      String value = ClassUtil.getValueOf(field, request, referenceClazz, String.class);

      map.putSingle(parameter, value);
    }

    return map;
  }
View Full Code Here

TOP

Related Classes of com.cloudcontrolled.api.client.body.BodyMultivaluedMap

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.