Alachisoft.NCache.Common.Monitoring.Counter 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.Monitoring;
import Alachisoft.NCache.Common.Common;
import Alachisoft.NCache.Common.Configuration.ConfigurationAttributeAnnotation;
import Alachisoft.NCache.Common.ICloneable;
import com.alachisoft.ncache.serialization.core.io.ICompactSerializable;
import com.alachisoft.ncache.serialization.core.io.InternalCompactSerializable;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectInput;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectOutput;
import com.alachisoft.ncache.serialization.standard.io.CompactReader;
import com.alachisoft.ncache.serialization.standard.io.CompactWriter;
import java.io.IOException;
public class Counter implements ICloneable , InternalCompactSerializable
{
private String _name = "";
private boolean _publish = false;
public Counter() { }
public Counter(String name,boolean publish)
{
setName(name);
setPublish(publish);
}
@ConfigurationAttributeAnnotation(value = "name", appendText = "")
public void setName(String name){ _name=name; }
@ConfigurationAttributeAnnotation(value = "name", appendText = "")
public String getName(){ return _name;}
@ConfigurationAttributeAnnotation(value = "publish", appendText = "")
public void setPublish(boolean publish){ _publish=publish;}
@ConfigurationAttributeAnnotation(value = "publish", appendText = "")
public boolean getPublish() { return _publish;}
@Override
public Object clone()
{
Counter counter = new Counter();
counter.setPublish(_publish);
counter.setName(_name);
return counter;
}
@Override
public void Deserialize(CompactReader reader) throws IOException, ClassNotFoundException {
setPublish(reader.ReadBoolean());
setName(Common.as(reader.ReadObject(),String.class));
}
@Override
public void Serialize(CompactWriter writer) throws IOException
{
writer.Write(getPublish());
writer.WriteObject(getName());
}
}