Alachisoft.NCache.Common.JSON.ExtendedJsonValueBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nc-common Show documentation
Show all versions of nc-common Show documentation
Internal package of Alachisoft.
package Alachisoft.NCache.Common.JSON;
import Alachisoft.NCache.Common.Caching.UserBinaryObject;
import Alachisoft.NCache.Common.ISizable;
import com.alachisoft.ncache.runtime.JSON.JsonValueBase;
import com.alachisoft.ncache.runtime.JSON.JsonValueType;
import com.alachisoft.ncache.serialization.core.io.ICompactSerializable;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectInput;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectOutput;
import java.io.IOException;
public abstract class ExtendedJsonValueBase extends JsonValueBase implements ISizable, ICompactSerializable
{
///#region ------------------------------ Fields ------------------------------
private int _size;
private int _inMemorySize;
///#endregion
///#region ---------------------------- Properties ----------------------------
private JsonValueType privateJsonType;
public JsonValueType getJsonType()
{
return privateJsonType;
}
private Object privateValue;
public Object getValue()
{
return privateValue;
}
public int getSize()
{
return _size;
}
protected void setSize(int value)
{
_size = value;
}
public int getInMemorySize()
{
return _inMemorySize;
}
protected void setInMemorySize(int value)
{
_inMemorySize = value;
}
///#endregion
///#region --------------------------- Constructors ---------------------------
public ExtendedJsonValueBase()
{
super();
// NOTE : .NET overhead of class is already included in base.InMemorySize
_size = super.getSize() + 9; // Size from base + size of two integer properties (8)
// + size of byte type enum (1)
_inMemorySize = super.getInMemorySize() + 9; // InMemorySize from base + size of two integer properties (8)
// + size of byte type enum (1)
}
///#endregion
///#region ----------------------------- Behavior -----------------------------
@Override
public String toJson()
{
throw new UnsupportedOperationException();
}
public UserBinaryObject toUserBinaryObject()
{
throw new UnsupportedOperationException();
}
///#endregion
// region ICompactSerializable
@Override
public void serialize(NCacheObjectOutput writer) throws IOException {
writer.writeInt(_size);
writer.writeInt(_inMemorySize);
}
@Override
public void deserialize(NCacheObjectInput reader) throws IOException, ClassNotFoundException {
_size = reader.readInt();
_inMemorySize = reader.readInt();
}
// endregion
}