public PropertiesAdapted marshal()

in integrations/rest-management/rest-management/src/main/java/org/apache/aries/jax/rs/rest/management/schema/PropertiesAdapter.java [52:136]


    public PropertiesAdapted marshal(Map<String, Object> map) throws Exception {
        PropertiesAdapted adapter = new PropertiesAdapted();
        for(Map.Entry<String, Object> entry : map.entrySet()) {
            Property property = new Property();
            property.key = entry.getKey();
            Object v = entry.getValue();

            boolean array = false;
            if (Long.class.isInstance(v)) {
                property.type = "Long";
            }
            else if (Long[].class.isInstance(v)) {
                property.type = "Long";
                array = true;
            }
            else if (Double.class.isInstance(v)) {
                property.type = "Double";
            }
            else if (Double[].class.isInstance(v)) {
                property.type = "Double";
                array = true;
            }
            else if (Float.class.isInstance(v)) {
                property.type = "Float";
            }
            else if (Float[].class.isInstance(v)) {
                property.type = "Float";
                array = true;
            }
            else if (Integer.class.isInstance(v)) {
                property.type = "Integer";
            }
            else if (Integer[].class.isInstance(v)) {
                property.type = "Integer";
                array = true;
            }
            else if (Byte.class.isInstance(v)) {
                property.type = "Byte";
            }
            else if (Byte[].class.isInstance(v)) {
                property.type = "Byte";
                array = true;
            }
            else if (Character.class.isInstance(v)) {
                property.type = "Character";
            }
            else if (Character[].class.isInstance(v)) {
                property.type = "Character";
                array = true;
            }
            else if (Boolean.class.isInstance(v)) {
                property.type = "Boolean";
            }
            else if (Boolean[].class.isInstance(v)) {
                property.type = "Boolean";
                array = true;
            }
            else if (Short.class.isInstance(v)) {
                property.type = "Short";
            }
            else if (Short[].class.isInstance(v)) {
                property.type = "Short";
                array = true;
            }
            else if (String[].class.isInstance(v)) {
                array = true;
            }

            if (!array) {
                property.attributeValue = String.valueOf(v);
            }
            else {
                property.elementValue = Arrays.stream(
                    (Object[])v
                ).map(
                    String::valueOf
                ).collect(
                    joining("\n")
                );
            }

            adapter.property.add(property);
        }
        return adapter;
    }