Package org.apache.logging.log4j
Class MarkerManager.Log4jMarker
- java.lang.Object
-
- org.apache.logging.log4j.MarkerManager.Log4jMarker
-
- All Implemented Interfaces:
java.io.Serializable,Marker,StringBuilderFormattable
- Enclosing class:
- MarkerManager
public static class MarkerManager.Log4jMarker extends java.lang.Object implements Marker, StringBuilderFormattable
Consider this class private, it is only public to satisfy Jackson for XML and JSON IO.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.MarkerMixInis moved to this package and would of course stay in its current module.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringnameprivate Marker[]parentsprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description privateLog4jMarker()Required by JAXB and Jackson for XML and JSON IO.Log4jMarker(java.lang.String name)Constructs a new Marker.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidaddParentInfo(java.lang.StringBuilder sb, Marker... parents)MarkeraddParents(Marker... parentMarkers)Adds a Marker as a parent to this Marker.private static booleancheckParent(Marker parent, Marker marker)private static booleancontains(Marker parent, Marker... localParents)booleanequals(java.lang.Object o)Returns true if the given marker has the same name as this marker.voidformatTo(java.lang.StringBuilder sb)Writes a text representation of this object into the specifiedStringBuilder, ideally without allocating temporary objects.java.lang.StringgetName()Returns the name of this Marker.Marker[]getParents()Returns a list of parents of this Marker.inthashCode()Returns a hash code value based on the name of this marker.booleanhasParents()Indicates whether this Marker has references to any other Markers.booleanisInstanceOf(java.lang.String markerName)Checks whether this Marker is an instance of the specified Marker.booleanisInstanceOf(Marker marker)Checks whether this Marker is an instance of the specified Marker.booleanremove(Marker parent)Removes the specified Marker as a parent of this Marker.MarkersetParents(Marker... markers)Replaces the set of parent Markers with the provided Markers.java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
name
private final java.lang.String name
-
parents
private volatile Marker[] parents
-
-
Method Detail
-
addParents
public Marker addParents(Marker... parentMarkers)
Description copied from interface:MarkerAdds a Marker as a parent to this Marker.- Specified by:
addParentsin interfaceMarker- Parameters:
parentMarkers- The parent markers to add.- Returns:
- The current Marker object, thus allowing multiple adds to be concatenated.
-
remove
public boolean remove(Marker parent)
Description copied from interface:MarkerRemoves the specified Marker as a parent of this Marker.
-
setParents
public Marker setParents(Marker... markers)
Description copied from interface:MarkerReplaces the set of parent Markers with the provided Markers.- Specified by:
setParentsin interfaceMarker- Parameters:
markers- The new set of parent Markers ornullto clear the parents.- Returns:
- The current Marker object.
-
getName
public java.lang.String getName()
Description copied from interface:MarkerReturns the name of this Marker.
-
getParents
public Marker[] getParents()
Description copied from interface:MarkerReturns a list of parents of this Marker.- Specified by:
getParentsin interfaceMarker- Returns:
- The parent Markers or
nullif this Marker has no parents.
-
hasParents
public boolean hasParents()
Description copied from interface:MarkerIndicates whether this Marker has references to any other Markers.- Specified by:
hasParentsin interfaceMarker- Returns:
trueif the Marker has parent Markers
-
isInstanceOf
public boolean isInstanceOf(Marker marker)
Description copied from interface:MarkerChecks whether this Marker is an instance of the specified Marker.- Specified by:
isInstanceOfin interfaceMarker- Parameters:
marker- The Marker to check.- Returns:
trueif this Marker or one of its ancestors is the specified Marker,falseotherwise.
-
isInstanceOf
public boolean isInstanceOf(java.lang.String markerName)
Description copied from interface:MarkerChecks whether this Marker is an instance of the specified Marker.- Specified by:
isInstanceOfin interfaceMarker- Parameters:
markerName- The name of the Marker.- Returns:
trueif this Marker or one of its ancestors matches the specified name,falseotherwise.
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:MarkerReturns true if the given marker has the same name as this marker.
-
hashCode
public int hashCode()
Description copied from interface:MarkerReturns a hash code value based on the name of this marker. Markers are equal if they have the same name.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
formatTo
public void formatTo(java.lang.StringBuilder sb)
Description copied from interface:StringBuilderFormattableWrites a text representation of this object into the specifiedStringBuilder, ideally without allocating temporary objects.- Specified by:
formatToin interfaceStringBuilderFormattable- Parameters:
sb- the StringBuilder to write into
-
addParentInfo
private static void addParentInfo(java.lang.StringBuilder sb, Marker... parents)
-
-