Package org.github.jamm

# Class Filters

java.lang.Object
org.github.jamm.Filters

public final class Filters extends Object
Utility class providing the different filters used by `MemoryMeter`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final FieldFilter`
`IGNORE_CLEANER_FIELDS`
Filter excluding some of the fields from sun.misc.Cleaner as they should not be taken into account.
`static final FieldAndClassFilter`
`IGNORE_KNOWN_SINGLETONS`
Filter excluding class such as `Enum`, `Class`, `ClassLoader` and `AccessControlContext`
`static final FieldFilter`
`IGNORE_NON_STRONG_REFERENCES`
Filter excluding all the Reference's fields and the `head` field of `ReferenceQueue`.
`static final FieldFilter`
`IGNORE_OUTER_CLASS_REFERENCES`
Filter excluding the outer class reference from non-static inner classes.
`static final FieldFilter`
`IGNORE_STATIC_AND_PRIMITIVE_FIELDS`
Filter excluding static and primitive fields
`static final FieldFilter`
`IGNORE_THREAD_FIELDS`
Filter excluding the `group` field from thread classes as that field holds the references to all the other threads from the group to which the thread belongs.
`static final FieldAndClassFilter`
`IGNORE_UNMETERED_FIELDS_AND_CLASSES`
Filter excluding fields and class annotated with `Unmetered`

## Method Summary

Modifier and Type
Method
Description
`static FieldAndClassFilter`
`getClassFilters(boolean ignoreKnownSingletons)`
`static FieldFilter`
`getFieldFilters(boolean ignoreKnownSingletons, boolean ignoreOuterClassReference, boolean ignoreNonStrongReferences)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### IGNORE_STATIC_AND_PRIMITIVE_FIELDS

public static final FieldFilter IGNORE_STATIC_AND_PRIMITIVE_FIELDS
Filter excluding static and primitive fields

### IGNORE_KNOWN_SINGLETONS

public static final FieldAndClassFilter IGNORE_KNOWN_SINGLETONS
Filter excluding class such as `Enum`, `Class`, `ClassLoader` and `AccessControlContext`

### IGNORE_NON_STRONG_REFERENCES

public static final FieldFilter IGNORE_NON_STRONG_REFERENCES
Filter excluding all the Reference's fields and the `head` field of `ReferenceQueue`. The Reference fields `next` and `discovered` are used by `ReferenceQueue` instances to create a linked list and are not part of what we want to measure. The `queue` field is either a singleton `ReferenceQueue.NULL` or a provided queue that user hold a reference to and therefore should be ignored too. To be consistent, the `head` field of `ReferenceQueue` is also ignored to fully decouple queue and references.

### IGNORE_CLEANER_FIELDS

public static final FieldFilter IGNORE_CLEANER_FIELDS
Filter excluding some of the fields from sun.misc.Cleaner as they should not be taken into account. The fields being excluded are:

- queue: as it is a dummy queue referenced by all Cleaner instances.
- next and prev: as they are used to create a doubly-linked list of live cleaners and therefore refer to other Cleaners instances

### IGNORE_THREAD_FIELDS

public static final FieldFilter IGNORE_THREAD_FIELDS
Filter excluding the `group` field from thread classes as that field holds the references to all the other threads from the group to which the thread belongs.

### IGNORE_OUTER_CLASS_REFERENCES

public static final FieldFilter IGNORE_OUTER_CLASS_REFERENCES
Filter excluding the outer class reference from non-static inner classes. In practice that filter is only useful if the top class is an inner class, and we wish to ignore the outer class in the measurement.

### IGNORE_UNMETERED_FIELDS_AND_CLASSES

public static final FieldAndClassFilter IGNORE_UNMETERED_FIELDS_AND_CLASSES
Filter excluding fields and class annotated with `Unmetered`

## Method Details

### getClassFilters

public static FieldAndClassFilter getClassFilters(boolean ignoreKnownSingletons)

### getFieldFilters

public static FieldFilter getFieldFilters(boolean ignoreKnownSingletons, boolean ignoreOuterClassReference, boolean ignoreNonStrongReferences)