Alachisoft.NCache.Common.JSON.UserObjectJsonValue Maven / Gradle / Ivy
package Alachisoft.NCache.Common.JSON;
import com.alachisoft.ncache.runtime.JSON.JsonValueBase;
import com.alachisoft.ncache.runtime.JSON.JsonValueType;
import java.io.Serializable;
public class UserObjectJsonValue extends ExtendedJsonValueBase implements Serializable
{
///#region ------------------------------ Fields ------------------------------
private Object _userObject;
///#endregion
///#region ---------------------------- Properties ----------------------------
@Override
public JsonValueType getJsonType()
{
return JsonValueType.Object;
}
@Override
public Object getValue()
{
return _userObject;
}
///#endregion
///#region --------------------------- Constructors ---------------------------
public UserObjectJsonValue(Object userObject, int size, int inMemorySize)
{
super();
_userObject = userObject;
setSize(getSize() + size);
setInMemorySize(getInMemorySize() + inMemorySize);
}
///#endregion
///#region ----------------------------- Behavior -----------------------------
@Override
public String toJson()
{
return (String) ((JsonValueBase)this).toJson();
}
///#endregion
///#region ---------------------------- Overrides -----------------------------
@Override
public boolean equals(Object obj)
{
UserObjectJsonValue secondJsonValue = (UserObjectJsonValue)((obj instanceof UserObjectJsonValue) ? obj : null);
if (secondJsonValue == null)
return false;
return _userObject.equals(secondJsonValue.getValue());
}
@Override
public int hashCode()
{
return _userObject.hashCode();
}
///#endregion
}