Module glf.api

Class BasicMarker

java.lang.Object
org.seppiko.glf.event.BasicMarker
All Implemented Interfaces:
Serializable, Marker

public class BasicMarker extends Object implements Marker
Basic Marker for default implementation
Author:
Leonard Woo
See Also:
  • Field Summary

    Fields inherited from interface org.seppiko.glf.api.Marker

    ANY_MARKER, ANY_NON_NULL_MARKER
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Marker reference)
    Add a reference to another Marker.
    boolean
    Does this marker contain the marker named 'name'? If 'name' is null the returned value is always false.
    boolean
    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).
    boolean
    Markers are considered equal if they have the same name.
    Get the name of this Marker.
    int
    Compute the hash code based on the name of this marker.
    boolean
    Does this marker have any references?
    Returns an Iterator which can be used to iterate over the references of this marker.
    boolean
    remove(Marker reference)
    Remove a marker reference.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BasicMarker

      public BasicMarker(String name)
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Marker
      Get the name of this Marker.
      Specified by:
      getName in interface Marker
      Returns:
      name of marker
    • add

      public void add(Marker reference)
      Description copied from interface: Marker
      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.

      Specified by:
      add in interface Marker
      Parameters:
      reference - a reference to another marker
    • remove

      public boolean remove(Marker reference)
      Description copied from interface: Marker
      Remove a marker reference.
      Specified by:
      remove in interface Marker
      Parameters:
      reference - the marker reference to remove
      Returns:
      true if reference could be found and removed, false otherwise.
    • hasReferences

      public boolean hasReferences()
      Description copied from interface: Marker
      Does this marker have any references?
      Specified by:
      hasReferences in interface Marker
      Returns:
      true if this marker has one or more references, false otherwise.
    • iterator

      public Iterator<Marker> iterator()
      Description copied from interface: Marker
      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.
      Specified by:
      iterator in interface Marker
      Returns:
      Iterator over the references of this marker
    • contains

      public boolean contains(Marker other)
      Description copied from interface: Marker
      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).
      Specified by:
      contains in interface Marker
      Parameters:
      other - The marker to test for inclusion.
      Returns:
      Whether this marker contains the other marker.
    • contains

      public boolean contains(String name)
      Description copied from interface: Marker
      Does this marker contain the marker named 'name'? If 'name' is null the returned value is always false.
      Specified by:
      contains in interface Marker
      Parameters:
      name - The marker name to test for inclusion.
      Returns:
      Whether this marker contains the other marker.
    • equals

      public boolean equals(Object o)
      Description copied from interface: Marker
      Markers are considered equal if they have the same name.
      Specified by:
      equals in interface Marker
      Overrides:
      equals in class Object
      Parameters:
      o -
      Returns:
      true, if this.name equals o.name
    • hashCode

      public int hashCode()
      Description copied from interface: Marker
      Compute the hash code based on the name of this marker. Note that markers are considered equal if they have the same name.
      Specified by:
      hashCode in interface Marker
      Overrides:
      hashCode in class Object
      Returns:
      the computed hashCode
    • toString

      public String toString()
      Overrides:
      toString in class Object