Top Description Fields Constructors Methods
net.sf.ehcache.pool.sizeof

public Class ReflectionSizeOf

extends SizeOf
Class Inheritance
Imports
java.lang.reflect.Array, .Field, .Modifier, java.util.Stack, org.slf4j.Logger, .LoggerFactory, net.sf.ehcache.pool.sizeof.filter.PassThroughFilter, .SizeOfFilter

SizeOf that uses reflection to measure on heap size of object graphs
Authors
Alex Snaps, Chris Dennis

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public
ReflectionSizeOf()

Builds a new SizeOf that will not filter fields and will cache reflected fields

public
ReflectionSizeOf(SizeOfFilter
The filter to apply
fieldFilter
)

Builds a new SizeOf that will filter fields and will cache reflected fields

public
ReflectionSizeOf(SizeOfFilter
The filter to apply
fieldFilter
,
boolean
Whether to cache reflected fields
caching
)

Builds a new SizeOf that will filter fields

Method Summary

Modifier and TypeMethod and Description
private long
public long
sizeOf(Object
the object to measure the size of
obj
)

Implements abstract net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Calculates the size in memory (heap) of the instance passed in, not navigating the down graph
Inherited from net.sf.ehcache.pool.sizeof.SizeOf:
deepSizeOf

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

ReflectionSizeOfback to summary
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)
ReflectionSizeOfback to summary
public ReflectionSizeOf(SizeOfFilter fieldFilter)

Builds a new SizeOf that will filter fields and will cache reflected fields

Parameters
fieldFilter:SizeOfFilter

The filter to apply

See Also
ReflectionSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean), SizeOfFilter
ReflectionSizeOfback to summary
public ReflectionSizeOf(SizeOfFilter fieldFilter, boolean caching)

Builds a new SizeOf that will filter fields

Parameters
fieldFilter:SizeOfFilter

The filter to apply

caching:boolean

Whether to cache reflected fields

See Also
SizeOfFilter

Method Detail

guessArraySizeback to summary
private long guessArraySize(Object obj)
sizeOfback to summary
public long sizeOf(Object obj)

Implements abstract net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Doc from net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Calculates the size in memory (heap) of the instance passed in, not navigating the down graph

Parameters
obj:Object

the object to measure the size of

Returns:long

the object size in memory in bytes

Annotations
@Override