public static enum NutsHeap.ListenerHolder extends Enum<NutsHeap.ListenerHolder>
The NutsHeap
is a NutDaoListener
registered in the NutDao
. Because the listeners are
registered in weak references, we must make sure a strong reference prevents the objects from garbage collection.
This class helps to keep a strong reference to the registered listener.
Enum Constant and Description |
---|
INSTANCE
Singleton.
|
Modifier and Type | Method and Description |
---|---|
void |
add(HeapListener l)
Adds a strong reference to the listener.
|
void |
clear()
Clears all strong references.
|
static NutsHeap.ListenerHolder |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static NutsHeap.ListenerHolder[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final NutsHeap.ListenerHolder INSTANCE
public static NutsHeap.ListenerHolder[] values()
for (NutsHeap.ListenerHolder c : NutsHeap.ListenerHolder.values()) System.out.println(c);
public static NutsHeap.ListenerHolder valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic void add(HeapListener l)
Adds a strong reference to the listener.
l
- the listenerpublic void clear()
Clears all strong references.
Copyright © 2012-2015. All Rights Reserved.