Top Description Fields Methods
org.slf4j

public Interface Marker

extends Serializable
Known Direct Implementers
org.slf4j.helpers.BasicMarker
Imports
java.io.Serializable, java.util.Iterator

Markers are named objects used to enrich log statements. Conforming logging system implementations of SLF4J should determine how information conveyed by any markers are used, if at all. Many conforming logging systems ignore marker data entirely.

Markers can contain references to nested markers, which in turn may contain references of their own. Note that the fluent API (new in 2.0) allows adding multiple markers to a logging statement. It is often preferable to use multiple markers instead of nested markers.

Author
Ceki Gülcü

Field Summary

Modifier and TypeField and Description
public static final String
ANY_MARKER

This constant represents any marker, including a null marker.

public static final String
ANY_NON_NULL_MARKER

This constant represents any non-null marker.

Method Summary

Modifier and TypeMethod and Description
public void
add(Marker
a reference to another marker
reference
)

Add a reference to another Marker.

public boolean

Returns:

Whether this marker contains the other marker.
contains
(Marker
The marker to test for inclusion.
other
)

Does this marker contain a reference to the 'other' marker?

public boolean

Returns:

Whether this marker contains the other marker.
contains
(String
The marker name to test for inclusion.
name
)

Does this marker contain the marker named 'name'?

public boolean

Returns:

true, if this.name equals o.name
equals
(Object o)

Markers are considered equal if they have the same name.

public String

Returns:

name of marker
getName
()

Get the name of this Marker.

public boolean
hasChildren()
Deprecated Replaced by hasReferences().

public int

Returns:

the computed hashCode
hashCode
()

Compute the hash code based on the name of this marker.

public boolean

Returns:

true if this marker has one or more references, false otherwise.
hasReferences
()

Does this marker have any references?

public Iterator<Marker>

Returns:

Iterator over the references of this marker
iterator
()

Returns an Iterator which can be used to iterate over the references of this marker.

public boolean

Returns:

true if reference could be found and removed, false otherwise.
remove
(Marker
the marker reference to remove
reference
)

Remove a marker reference.

Field Detail

ANY_MARKERback to summary
public static final String ANY_MARKER

This constant represents any marker, including a null marker.

ANY_NON_NULL_MARKERback to summary
public static final String ANY_NON_NULL_MARKER

This constant represents any non-null marker.

Method Detail

addback to summary
public void add(Marker reference)

Add a reference to another Marker.

Note that the fluent API allows adding multiple markers to a logging statement. It is often preferable to use multiple markers instead of nested markers.

Parameters
reference:Marker

a reference to another marker

Exceptions
IllegalArgumentException:
if 'reference' is null
containsback to summary
public boolean contains(Marker other)

Does this marker contain a reference to the 'other' marker? Marker A is defined to contain marker B, if A == B or if B is referenced by A, or if B is referenced by any one of A's references (recursively).

Parameters
other:Marker

The marker to test for inclusion.

Returns:boolean

Whether this marker contains the other marker.

Exceptions
IllegalArgumentException:
if 'other' is null
containsback to summary
public boolean contains(String name)

Does this marker contain the marker named 'name'? If 'name' is null the returned value is always false.

Parameters
name:String

The marker name to test for inclusion.

Returns:boolean

Whether this marker contains the other marker.

equalsback to summary
public boolean equals(Object o)

Markers are considered equal if they have the same name.

Returns:boolean

true, if this.name equals o.name

Since
1.5.1
getNameback to summary
public String getName()

Get the name of this Marker.

Returns:String

name of marker

hasChildrenback to summary
public boolean hasChildren()

Deprecated

Replaced by hasReferences().

Annotations
@Deprecated
hashCodeback to summary
public int hashCode()

Compute the hash code based on the name of this marker. Note that markers are considered equal if they have the same name.

Returns:int

the computed hashCode

Since
1.5.1
hasReferencesback to summary
public boolean hasReferences()

Does this marker have any references?

Returns:boolean

true if this marker has one or more references, false otherwise.

iteratorback to summary
public Iterator<Marker> iterator()

Returns an Iterator which can be used to iterate over the references of this marker. An empty iterator is returned when this marker has no references.

Returns:Iterator<Marker>

Iterator over the references of this marker

removeback to summary
public boolean remove(Marker reference)

Remove a marker reference.

Parameters
reference:Marker

the marker reference to remove

Returns:boolean

true if reference could be found and removed, false otherwise.