Serializable
, Comparator<LogRecord>
public class SeverityComparator extends Object implements Comparator<LogRecord>, 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.
Constructor | Description |
---|---|
SeverityComparator() |
Modifier and Type | Method | Description |
---|---|---|
Throwable |
apply(Throwable chain) |
Identifies a single throwable that best describes the given throwable and
the entire cause chain.
|
int |
applyThenCompare(Throwable tc1,
Throwable tc2) |
Reduces each throwable chain argument
then compare each throwable result. |
int |
compare(LogRecord o1,
LogRecord o2) |
Compares two log records based on severity.
|
int |
compareThrowable(Throwable t1,
Throwable t2) |
Compares two throwable objects or null.
|
boolean |
equals(Object o) |
Determines if the given object is also a comparator and it imposes the
same ordering as this comparator.
|
int |
hashCode() |
Returns a hash code value for the object.
|
boolean |
isNormal(Throwable t) |
Determines if the given throwable instance is "normal occurrence".
|
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public Throwable apply(Throwable chain)
compare(java.util.logging.LogRecord, java.util.logging.LogRecord)
.chain
- the throwable or null.isNormal(java.lang.Throwable)
public final int applyThenCompare(Throwable tc1, 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(Throwable t1, 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(LogRecord o1, LogRecord o2)
compare
in interface Comparator<LogRecord>
o1
- the first log record.o2
- the second log record.NullPointerException
- if either argument is null.public boolean equals(Object o)
equals
in interface Comparator<LogRecord>
equals
in class Object
o
- the reference object with which to compare.public int hashCode()
public boolean isNormal(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.Copyright © 2018 Oracle. All rights reserved.