com.eg.agent.android.MemoryInformation Maven / Gradle / Ivy
package com.eg.agent.android;
import com.eg.google.gson.JsonObject;
import com.eg.google.gson.JsonPrimitive;
public class MemoryInformation {
private static MemoryInformation instance=new MemoryInformation();
private long memoryUsage;
private long[] diskAvailable;
private String phoneAppMemory;
public static MemoryInformation getInstance(){
return instance;
}
public void setMemoryUsage(long memoryUsage)
{
this.memoryUsage = memoryUsage;
}
public void setDiskAvailable(long[] diskAvailable)
{
this.diskAvailable = diskAvailable;
}
public long getMemoryUsage()
{
return this.memoryUsage;
}
public long[] getDiskAvailable()
{
return this.diskAvailable;
}
public void setPhoneAppMemory(String phoneAppMemory) {
this.phoneAppMemory = phoneAppMemory;
}
public String getPhoneAppMemory(){return this.phoneAppMemory;}
public JsonObject asJsonObject() {
JsonObject data = new JsonObject();
data.add("memoryUsage",new JsonPrimitive(this.memoryUsage));
data.add("diskAvailable",new JsonPrimitive(String.valueOf(this.diskAvailable)));
data.add("phoneAppMemory",new JsonPrimitive(this.phoneAppMemory));
return data;
}
public static MemoryInformation newFromJson(JsonObject jsonObject)
{
MemoryInformation info = new MemoryInformation();
info.memoryUsage = jsonObject.get("memoryUsage").getAsLong();
info.phoneAppMemory = jsonObject.get("phoneAppMemory").getAsString();
return info;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy