Package org.apache.logging.log4j
Class MarkerManager.Log4jMarker
java.lang.Object
org.apache.logging.log4j.MarkerManager.Log4jMarker
- All Implemented Interfaces:
Serializable
,Marker
,StringBuilderFormattable
- Enclosing class:
- MarkerManager
public static class MarkerManager.Log4jMarker
extends 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.MarkerMixIn
is moved to this package and would of course stay in its current module.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddParents
(Marker... parentMarkers) Adds a Marker as a parent to this Marker.boolean
Returns true if the given marker has the same name as this marker.void
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.getName()
Returns the name of this Marker.Marker[]
Returns a list of parents of this Marker.int
hashCode()
Returns a hash code value based on the name of this marker.boolean
Indicates whether this Marker has references to any other Markers.boolean
isInstanceOf
(String markerName) Checks whether this Marker is an instance of the specified Marker.boolean
isInstanceOf
(Marker marker) Checks whether this Marker is an instance of the specified Marker.boolean
Removes the specified Marker as a parent of this Marker.setParents
(Marker... markers) Replaces the set of parent Markers with the provided Markers.toString()
-
Constructor Details
-
Log4jMarker
Constructs a new Marker.- Parameters:
name
- the name of the Marker.- Throws:
IllegalArgumentException
- if the argument isnull
-
-
Method Details
-
addParents
Description copied from interface:Marker
Adds a Marker as a parent to this Marker.- Specified by:
addParents
in interfaceMarker
- Parameters:
parentMarkers
- The parent markers to add.- Returns:
- The current Marker object, thus allowing multiple adds to be concatenated.
-
remove
Description copied from interface:Marker
Removes the specified Marker as a parent of this Marker. -
setParents
Description copied from interface:Marker
Replaces the set of parent Markers with the provided Markers.- Specified by:
setParents
in interfaceMarker
- Parameters:
markers
- The new set of parent Markers ornull
to clear the parents.- Returns:
- The current Marker object.
-
getName
Description copied from interface:Marker
Returns the name of this Marker. -
getParents
Description copied from interface:Marker
Returns a list of parents of this Marker.- Specified by:
getParents
in interfaceMarker
- Returns:
- The parent Markers or
null
if this Marker has no parents.
-
hasParents
public boolean hasParents()Description copied from interface:Marker
Indicates whether this Marker has references to any other Markers.- Specified by:
hasParents
in interfaceMarker
- Returns:
true
if the Marker has parent Markers
-
isInstanceOf
Description copied from interface:Marker
Checks whether this Marker is an instance of the specified Marker.- Specified by:
isInstanceOf
in interfaceMarker
- Parameters:
marker
- The Marker to check.- Returns:
true
if this Marker or one of its ancestors is the specified Marker,false
otherwise.
-
isInstanceOf
Description copied from interface:Marker
Checks whether this Marker is an instance of the specified Marker.- Specified by:
isInstanceOf
in interfaceMarker
- Parameters:
markerName
- The name of the Marker.- Returns:
true
if this Marker or one of its ancestors matches the specified name,false
otherwise.
-
equals
Description copied from interface:Marker
Returns true if the given marker has the same name as this marker. -
hashCode
public int hashCode()Description copied from interface:Marker
Returns a hash code value based on the name of this marker. Markers are equal if they have the same name. -
toString
-
formatTo
Description copied from interface:StringBuilderFormattable
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.- Specified by:
formatTo
in interfaceStringBuilderFormattable
- Parameters:
sb
- the StringBuilder to write into
-