public class SeverityComparator
extends java.lang.Object
implements java.util.Comparator<java.util.logging.LogRecord>, java.io.Serializable
The following LogRecord properties determine severity ordering:
Throwable
defined as
"normal occurrence
".
java.lang.Throwable
class and is not a
java.lang.RuntimeException
or a java.lang.Error
.
java.lang.RuntimeException
objects.
java.lang.Error
objects.
Modifier and Type | Field and Description |
---|---|
private static java.util.Comparator<java.util.logging.LogRecord> |
INSTANCE
A single instance that is shared among the logging package.
|
private static long |
serialVersionUID
The generated serial version UID.
|
Constructor and Description |
---|
SeverityComparator() |
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
apply(java.lang.Throwable chain)
Identifies a single throwable that best describes the given throwable and
the entire cause chain.
|
int |
applyThenCompare(java.lang.Throwable tc1,
java.lang.Throwable tc2)
Reduces each throwable chain argument
then compare each throwable result. |
private int |
compare(java.util.logging.Level a,
java.util.logging.Level b)
Compare two level objects.
|
int |
compare(java.util.logging.LogRecord o1,
java.util.logging.LogRecord o2)
Compares two log records based on severity.
|
private int |
compare(long x,
long y)
Compare two longs.
|
int |
compareThrowable(java.lang.Throwable t1,
java.lang.Throwable t2)
Compares two throwable objects or null.
|
boolean |
equals(java.lang.Object o)
Determines if the given object is also a comparator and it imposes the
same ordering as this comparator.
|
(package private) static SeverityComparator |
getInstance()
A shared instance of a SeverityComparator.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isNormal(java.lang.Throwable t)
Determines if the given throwable instance is "normal occurrence".
|
private static java.lang.String |
toString(java.lang.Object o1,
java.lang.Object o2)
Outline the message create string.
|
private static final long serialVersionUID
private static final java.util.Comparator<java.util.logging.LogRecord> INSTANCE
static SeverityComparator getInstance()
public java.lang.Throwable apply(java.lang.Throwable chain)
compare(java.util.logging.LogRecord, java.util.logging.LogRecord)
.chain
- the throwable or null.isNormal(java.lang.Throwable)
public final int applyThenCompare(java.lang.Throwable tc1, java.lang.Throwable tc2)
Reduces
each throwable chain argument
then compare each throwable result.tc1
- the first throwable chain or null.tc2
- the second throwable chain or null.apply(java.lang.Throwable)
,
compareThrowable(java.lang.Throwable, java.lang.Throwable)
public int compareThrowable(java.lang.Throwable t1, java.lang.Throwable t2)
reduce
each argument before
comparing. This is method can be overridden to change the behavior of
compare(LogRecord, LogRecord).t1
- the first throwable or null.t2
- the second throwable or null.isNormal(java.lang.Throwable)
public int compare(java.util.logging.LogRecord o1, java.util.logging.LogRecord o2)
compare
in interface java.util.Comparator<java.util.logging.LogRecord>
o1
- the first log record.o2
- the second log record.java.lang.NullPointerException
- if either argument is null.public boolean equals(java.lang.Object o)
equals
in interface java.util.Comparator<java.util.logging.LogRecord>
equals
in class java.lang.Object
o
- the reference object with which to compare.public int hashCode()
hashCode
in class java.lang.Object
public boolean isNormal(java.lang.Throwable t)
java.lang.ThreadDeath
object or
subclasses.
This method can be overridden to change the behavior of the
apply(java.lang.Throwable) method.t
- a throwable or null.private int compare(java.util.logging.Level a, java.util.logging.Level b)
a
- the first level.b
- the second level.private static java.lang.String toString(java.lang.Object o1, java.lang.Object o2)
o1
- argument one.o2
- argument two.private int compare(long x, long y)
x
- the first long.y
- the second long.