Beispiel #1
0
 @Override
 public int getCachedSize() {
   // Approximate the size of the object in bytes by calculating the size
   // of each field.
   int size = 0;
   size += CacheSizes.sizeOfObject(); // overhead of object
   size += nodeID.toByteArray().length; // Node ID
   size += CacheSizes.sizeOfBoolean(); // available
   return size;
 }
Beispiel #2
0
 public int getCachedSize() throws CannotCalculateSizeException {
   // Approximate the size of the object in bytes by calculating the size
   // of each field.
   int size = 0;
   size += CacheSizes.sizeOfObject(); // overhead of object
   size += CacheSizes.sizeOfString(userJID.toString()); // userJID
   size += CacheSizes.sizeOfString(name); // name
   size += CacheSizes.sizeOfBoolean(); // isDefault
   size += CacheSizes.sizeOfCollection(items); // items of the list
   return size;
 }