package info.archinnov.achilles.entity.type;

import java.io.Serializable;

/**
 * KeyValue
 * 
 * Holder structure for key/value pair
 * 
 * @author DuyHai DOAN
 * 
 */
public class KeyValue<K, V> implements Serializable
{
	public static final long serialVersionUID = 1L;

	private K key;
	private V value;
	private int ttl;

	/**
	 * Default constructor
	 */
	public KeyValue() {}

	/**
	 * Create a KeyValue holder with ttl
	 * 
	 * @param key
	 *            Key
	 * @param value
	 *            Value
	 * @param ttl
	 *            Time to live
	 */
	public KeyValue(K key, V value, int ttl) {
		this.key = key;
		this.value = value;
		this.ttl = ttl;
	}

	/**
	 * Create a KeyValue holder
	 * 
	 * @param key
	 *            Key
	 * @param value
	 *            Value
	 */
	public KeyValue(K key, V value) {
		this.key = key;
		this.value = value;
		this.ttl = 0;
	}

	/**
	 * Get the key
	 * 
	 * @return key
	 */
	public K getKey()
	{
		return key;
	}

	/**
	 * Get the value, can be null
	 * 
	 * @return value
	 */
	public V getValue()
	{
		return value;
	}

	/**
	 * Get the time to live, can be null
	 * 
	 * If null, the value never expires
	 * 
	 * @return ttl
	 */
	public int getTtl()
	{
		return ttl;
	}
}

@@ -69,16 +69,176 @@
 zable;%0A%0A
+import org.codehaus.jackson.annotate.JsonTypeInfo;%0Aimport org.codehaus.jackson.annotate.JsonTypeInfo.As;%0Aimport org.codehaus.jackson.annotate.JsonTypeInfo.Id;%0A%0A
 /**%0A * K
@@ -323,16 +323,17 @@
  * %0A */%0A
+%0A
 public c
@@ -433,22 +433,131 @@
 ;%0A%0A%09
-private K key;
+@JsonTypeInfo(use = Id.CLASS, include = As.PROPERTY)%0A%09private K key;%0A%0A%09@JsonTypeInfo(use = Id.CLASS, include = As.PROPERTY)
 %0A%09pr

Add JSON type info on the KeyValue class to restore the type when deserializing