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; }