
Untitled
By: a guest on
Aug 15th, 2011 | syntax:
None | size: 0.53 KB | views:
42 | expires: Never
@ConversationScoped
public class ObjectStore implements Serializable
{
private static final long serialVersionUID = 1L;
private BiMap<String, Object> map = HashBiMap.create();
private int key;
public Object string2Object(String key)
{
return map.get(key);
}
public String object2String(Object object)
{
if (map.inverse().containsKey(object))
{
return map.inverse().get(object);
}
else
{
String strKey = String.valueOf(key++);
map.put(strKey, object);
return strKey;
}
}
}