/**
  * Cecks if a given class c is of primitive type. String in this case is a primitive type as well
  *
  * @param c The class to check
  * @return True if the Class c is a primitive type otherwise false
  */
 public static boolean isPrimitive(Class<?> c) {
   if (ObjectParameterHelper.isWrapperType(c) || c.isPrimitive()) {
     return true;
   } else {
     return false;
   }
 }
 public static Map<String, Content> getParameterMap(Map<String, Class<?>> strClasMap) {
   Map<String, Content> ret = new HashMap<String, Content>();
   Iterator it = strClasMap.keySet().iterator();
   while (it.hasNext()) {
     // Content cont = new Content();
     String key = (String) it.next();
     ret.put(key, ObjectParameterHelper.getContent(strClasMap.get(key)));
   }
   return ret;
 }
  private static Map<String, List<Content>> getComplexObjectMap(Class<?> c) {
    Map<String, List<Content>> ret = new HashMap<String, List<Content>>();

    for (Field f : c.getFields()) {
      List<Content> contentList = new ArrayList<Content>();
      Content content = ObjectParameterHelper.getContent(f.getType());
      contentList.add(content);
      ret.put(f.getName(), contentList);
    }
    return ret;
  }
 private static Content getContent(Class<?> clazz) {
   Content content = new Content();
   if (clazz.isArray()) {
     content.setArray(true);
     clazz = clazz.getComponentType();
   } else {
     content.setArray(false);
   }
   if (ObjectParameterHelper.isWrapperType(clazz) || clazz.isPrimitive()) {
     content.setPrimitive(true);
     content.setMapValues(null);
     log.debug("is primitive->" + clazz.getSimpleName());
   } else {
     content.setPrimitive(false);
     content.setMapValues(ObjectParameterHelper.getComplexObjectMap(clazz));
     log.debug("is not primitive " + clazz.getSimpleName());
   }
   content.setType(clazz.getSimpleName());
   return content;
 }
  /**
   * Gets the parameter map for the list of parameters provided
   *
   * @param parameters The list of parameters which needs to be transformed to a Map
   * @return The map which contains the parameters so the ui can work wit it
   */
  public static Map<String, List<Content>> getParameterMap(List<Parameter> parameters) {
    Map<String, List<Content>> ret = new HashMap<String, List<Content>>();
    for (Parameter p : parameters) {
      List<Content> cList = new ArrayList<Content>();
      Content c = new Content();
      if (p.getType().endsWith("[]")) c.setArray(true);
      else c.setArray(false);
      c.setMapValues(null);
      if (ObjectParameterHelper.isPrimitiveType((p.getType()))) {
        c.setPrimitive(true);
      } else {
        c.setPrimitive(false);
      }
      c.setType(p.getType());
      cList.add(c);
      ret.put(p.getName(), cList);
    }

    return ret;
  }