All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.minijson.tool.profiler.SampleJsonCompatibleObject Maven / Gradle / Ivy

The newest version!
package org.minijson.tool.profiler;

import java.util.LinkedHashMap;
import java.util.Map;

import org.minijson.JsonCompatible;
import org.minijson.builder.JsonBuilderException;


public class SampleJsonCompatibleObject implements JsonCompatible
{

    public SampleJsonCompatibleObject()
    {
    }

//    @Override
//    public boolean isJsonStructureArray()
//    {
//        return false;
//    }

    @Override
    public Object toJsonStructure() throws JsonBuilderException
    {
        return toJsonStructure(1);
    }

    @Override
    public Object toJsonStructure(int depth) throws JsonBuilderException
    {
        Map map = new LinkedHashMap();
        if(depth > 0) {
            map.put("k1", "v1");
            if(depth > 1) {
                Map map2 = new LinkedHashMap();
                map2.put("x1", "y1");
                map.put("k2", map2);
                if(depth > 2) {
                    Map map3 = new LinkedHashMap();
                    map3.put("m1", "n1");
                    map2.put("x2", map3);
                }
            }
        }        
        return map;
    }

    @Override
    public String toString()
    {
        return "SampleJsonCompatibleObject []";
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy