Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.HashMap;

import java.util.Map;

import org.w3c.dom.Node;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import com.google.gson.JsonPrimitive;

public class Main {
    private static final String EMPTY = "";
    static Map<String, JsonElement> REORGANIZED = new HashMap<String, JsonElement>();

    private static void reorganizePrimitiveToArray(Node parentNode, JsonObject upperJson, JsonObject childJson,
            Node childNode, JsonElement existing) {
        upperJson.remove(parentNode.getNodeName());
        JsonArray arrayJson = new JsonArray();
        arrayJson.add(existing);
        arrayJson.add(new JsonPrimitive(childNode.getNodeValue()));
        upperJson.add(parentNode.getNodeName(), arrayJson);
        REORGANIZED.put(parentNode.hashCode() + EMPTY, childJson);
    }
}