org.mmbase.util
Interface SizeMeasurable

All Known Implementing Classes:
BasicCloud, BasicNode, Cache, LRUHashtable, LRUHashtable.LRUEntry, MMObjectNode, URIResolver, Wizard

public interface SizeMeasurable

The SizeOf class tries to determine the size of memory structures. This is tried by reflection and so on, but if an object is 'SizeMeasurable' then it is asked to the object directly.

So, if your object stores its bulk in private members, and you want its size to be determined adequately, then you should let it implement this interface.

If you did not implement a class yourself, but have a clue how to guess the size anyhow, then you could also put this implementation in SizeOf itself (as for example was done for String). The disadvantage of this approach is of course that you don't have access to private members.

Since:
MMBase-1.6
Version:
$Id: SizeMeasurable.java,v 1.4 2005/05/20 09:02:54 michiel Exp $
Author:
Michiel Meeuwissen

Method Summary
 int getByteSize()
          Determines the byte-size of this object
 int getByteSize(SizeOf sizeof)
          Determines the byte-size of this object using the given SizeOf instance.
 

Method Detail

getByteSize

public int getByteSize()
Determines the byte-size of this object


getByteSize

public int getByteSize(SizeOf sizeof)
Determines the byte-size of this object using the given SizeOf instance. A SizeOf instance stores a Set already counted objects. So this method is typically called by SizeOf itself (recursion).



MMBase build 1.8.1.20060716