- java.lang.Object
-
- io.github.stasgora.observetree.listener.ListenerEntry
-
- All Implemented Interfaces:
Comparable<ListenerEntry>
public class ListenerEntry extends Object implements Comparable<ListenerEntry>
Internal data class holding listener reference together with its priority. Overrides standard methods that ensure proper aggregation in collections.- Author:
- Stanisław Góra
- See Also:
ChangeListener
-
-
Field Summary
Fields Modifier and Type Field Description ChangeListener
listener
Listener callback method referenceint
priority
Listener priority
-
Constructor Summary
Constructors Constructor Description ListenerEntry(ChangeListener listener, int priority)
Constructs new listener entry object
-
Method Summary
Modifier and Type Method Description int
compareTo(ListenerEntry o)
Compares the specified object with thisListenerEntry
.boolean
equals(Object o)
Compares the specified object with thisListenerEntry
for equality.int
hashCode()
Returns the hash code value for thisListenerEntry
.
-
-
-
Field Detail
-
listener
public ChangeListener listener
Listener callback method reference
-
priority
public int priority
Listener priority
-
-
Constructor Detail
-
ListenerEntry
public ListenerEntry(ChangeListener listener, int priority)
Constructs new listener entry object- Parameters:
listener
- listener callback method referencepriority
- listener priority
-
-
Method Detail
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
compareTo
public int compareTo(ListenerEntry o)
Compares the specified object with thisListenerEntry
. It sorts the objects in a descending order according to theirpriority
.- Specified by:
compareTo
in interfaceComparable<ListenerEntry>
- Parameters:
o
-ListenerEntry
to which thisListenerEntry
is to be compared- Returns:
- -1 or 1 as this
ListenerEntry
should be placed before or behindo
or 0 if the objects are equal.
-
-