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

io.baltoro.ep.EPData Maven / Gradle / Ivy

There is a newer version: 4.0.12
Show newest version
package io.baltoro.ep;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class EPData
{

	private static ObjectMapper mapper = new ObjectMapper();
	
	List list = new ArrayList();
	
	public void add(String name, Object value)
	{
		Object[] objs = new Object[2];
		objs[0] = name;
		if(value instanceof String)
		{
			objs[1] = value;
		}
		else if(value instanceof Integer)
		{
			objs[1] = value;
		}
		else if(value instanceof Long)
		{
			objs[1] = value;
		}
		else
		{
			try
			{
				objs[1] = mapper.writeValueAsString(value);
			} 
			catch (JsonProcessingException e)
			{
				e.printStackTrace();
			}
		}
		
		list.add(objs);
	}
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy