@Override
public JsonObject objectToJsonMapper(DataObject ofStat) {
JsonObject nodeGroupStatisticsJsonObject = null;
GroupStatistics groupStat = (GroupStatistics) ofStat;
if (groupStat.getByteCount() != null && groupStat.getDuration() != null && groupStat.getPacketCount() != null
&& groupStat.getBuckets() != null && groupStat.getGroupId() != null
&& groupStat.getRefCount() != null) {
nodeGroupStatisticsJsonObject = factory.createObjectBuilder()
.add(properties.getProperty("STAT_TYPE"), properties.getProperty("GRP_STAT"))
.add(properties.getProperty("TIMESTAMP"), System.currentTimeMillis())
.add(properties.getProperty("OFSTATS"), factory.createObjectBuilder()
.add(properties.getProperty("BYTE_COUNT"), groupStat.getByteCount().getValue())
.add(properties.getProperty("DURATION_SEC"), groupStat.getDuration().getSecond().getValue())
.add(properties.getProperty("DURATION_NANOSEC"),
groupStat.getDuration().getNanosecond().getValue())
.add(properties.getProperty("PACK_COUNT"), groupStat.getPacketCount().getValue())
.add(properties.getProperty("REF_COUNT"), groupStat.getRefCount().getValue())
.add(properties.getProperty("GRP_ID"), groupStat.getGroupId().getValue())
.add(properties.getProperty("BUCK"),
createBandStatsJsonArrayObject(groupStat.getBuckets().getBucketCounter())))
.build();
}
return nodeGroupStatisticsJsonObject;
}