ehcache

net.sf.ehcache.pool.sizeof
Class ReflectionSizeOf

java.lang.Object
  extended by net.sf.ehcache.pool.sizeof.SizeOf
      extended by net.sf.ehcache.pool.sizeof.ReflectionSizeOf

public class ReflectionSizeOf
extends SizeOf

SizeOf that uses reflection to measure on heap size of object graphs

Author:
Alex Snaps, Chris Dennis

Constructor Summary
ReflectionSizeOf()
          Builds a new SizeOf that will not filter fields and will cache reflected fields
ReflectionSizeOf(SizeOfFilter fieldFilter)
          Builds a new SizeOf that will filter fields and will cache reflected fields
ReflectionSizeOf(SizeOfFilter fieldFilter, boolean caching)
          Builds a new SizeOf that will filter fields
 
Method Summary
 long sizeOf(Object obj)
          Calculates the size in memory (heap) of the instance passed in, not navigating the down graph
 
Methods inherited from class net.sf.ehcache.pool.sizeof.SizeOf
deepSizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionSizeOf

public ReflectionSizeOf()
Builds a new SizeOf that will not filter fields and will cache reflected fields

See Also:
ReflectionSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean)

ReflectionSizeOf

public ReflectionSizeOf(SizeOfFilter fieldFilter)
Builds a new SizeOf that will filter fields and will cache reflected fields

Parameters:
fieldFilter - The filter to apply
See Also:
ReflectionSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean), SizeOfFilter

ReflectionSizeOf

public ReflectionSizeOf(SizeOfFilter fieldFilter,
                        boolean caching)
Builds a new SizeOf that will filter fields

Parameters:
fieldFilter - The filter to apply
caching - Whether to cache reflected fields
See Also:
SizeOfFilter
Method Detail

sizeOf

public long sizeOf(Object obj)
Calculates the size in memory (heap) of the instance passed in, not navigating the down graph

Specified by:
sizeOf in class SizeOf
Parameters:
obj - the object to measure the size of
Returns:
the object size in memory in bytes

ehcache

Copyright 2001-2014, Terracotta, Inc.