package org.kne.cloud.network.klalb;

import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;

import javax.annotation.processing.Filer;
import javax.lang.model.element.Element;
import javax.tools.FileObject;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileManager.Location;

import org.kne.cloud.network.MultipurposeSocketAddress;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonIOException;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.JsonSyntaxException;

import java.io.File;
import java.io.FileNotFoundException;

public class KLALBConfig extends ArrayList<KLALBConfigItem>{
	public static void main(String[] args) throws UnknownHostException, JsonSyntaxException, JsonIOException, FileNotFoundException {
		GsonBuilder gb=new GsonBuilder().setPrettyPrinting();
		MultipurposeSocketAddress.registerToGsonBuilder(gb);
		KLALBConfigItem.registerToGsonBuilder(gb);
		Gson gson=gb.create();
		KLALBConfig kc=gson.fromJson(new FileReader(new File("klalb-config.json")),KLALBConfig.class);
		System.out.println(kc);
		String s=gson.toJson(kc);
		System.out.println(s);
		
	}

	
}
