public static class MarkerManager.Log4jMarker extends java.lang.Object implements Marker, StringBuilderFormattable
The actual Marker implementation.
Internal note: We could make this class package private instead of public if the class
org.apache.logging.log4j.core.jackson.MarkerMixIn
is moved to this package and would of course stay in its current module.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
name |
private Marker[] |
parents |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
Log4jMarker()
Required by JAXB and Jackson for XML and JSON IO.
|
|
Log4jMarker(java.lang.String name)
Constructs a new Marker.
|
Modifier and Type | Method and Description |
---|---|
private static void |
addParentInfo(java.lang.StringBuilder sb,
Marker... parents) |
Marker |
addParents(Marker... parentMarkers)
Adds a Marker as a parent to this Marker.
|
private static boolean |
checkParent(Marker parent,
Marker marker) |
private static boolean |
contains(Marker parent,
Marker... localParents) |
boolean |
equals(java.lang.Object o)
Returns true if the given marker has the same name as this marker.
|
void |
formatTo(java.lang.StringBuilder sb)
Writes a text representation of this object into the specified
StringBuilder , ideally without allocating
temporary objects. |
java.lang.String |
getName()
Returns the name of this Marker.
|
Marker[] |
getParents()
Returns a list of parents of this Marker.
|
int |
hashCode()
Returns a hash code value based on the name of this marker.
|
boolean |
hasParents()
Indicates whether this Marker has references to any other Markers.
|
boolean |
isInstanceOf(Marker marker)
Checks whether this Marker is an instance of the specified Marker.
|
boolean |
isInstanceOf(java.lang.String markerName)
Checks whether this Marker is an instance of the specified Marker.
|
boolean |
remove(Marker parent)
Removes the specified Marker as a parent of this Marker.
|
Marker |
setParents(Marker... markers)
Replaces the set of parent Markers with the provided Markers.
|
java.lang.String |
toString() |
private static final long serialVersionUID
private final java.lang.String name
private volatile Marker[] parents
private Log4jMarker()
public Log4jMarker(java.lang.String name)
name
- the name of the Marker.java.lang.IllegalArgumentException
- if the argument is null
public Marker addParents(Marker... parentMarkers)
Marker
addParents
in interface Marker
parentMarkers
- The parent markers to add.public boolean remove(Marker parent)
Marker
public Marker setParents(Marker... markers)
Marker
setParents
in interface Marker
markers
- The new set of parent Markers or null
to clear the parents.public java.lang.String getName()
Marker
public Marker[] getParents()
Marker
getParents
in interface Marker
null
if this Marker has no parents.public boolean hasParents()
Marker
hasParents
in interface Marker
true
if the Marker has parent Markerspublic boolean isInstanceOf(Marker marker)
Marker
isInstanceOf
in interface Marker
marker
- The Marker to check.true
if this Marker or one of its ancestors is the specified Marker, false
otherwise.public boolean isInstanceOf(java.lang.String markerName)
Marker
isInstanceOf
in interface Marker
markerName
- The name of the Marker.true
if this Marker or one of its ancestors matches the specified name, false
otherwise.public boolean equals(java.lang.Object o)
Marker
public int hashCode()
Marker
public java.lang.String toString()
toString
in class java.lang.Object
public void formatTo(java.lang.StringBuilder sb)
StringBuilderFormattable
StringBuilder
, ideally without allocating
temporary objects.formatTo
in interface StringBuilderFormattable
sb
- the StringBuilder to write intoprivate static void addParentInfo(java.lang.StringBuilder sb, Marker... parents)