001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache license, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the license for the specific language governing permissions and
015 * limitations under the license.
016 */
017package org.apache.logging.log4j;
018
019import java.io.Serializable;
020
021/**
022 *  Markers are objects that are used to add easily filterable information to log messages.
023 *
024 *  Markers can be hierarchical - each Marker may have a parent. This allows for broad categories
025 *  being subdivided into more specific categories. An example might be a Marker named "Error" with
026 *  children named "SystemError" and "ApplicationError".
027 */
028public interface Marker extends Serializable {
029
030    /**
031     * Returns the name of this Marker.
032     * @return The name of the Marker.
033     */
034    String getName();
035
036    /**
037     * Returns the parent of this Marker.
038     * @return The parent Marker or null if this Marker has no parent.
039     */
040    Marker getParent();
041
042    /**
043     * Checks whether this Marker is an instance of the specified Marker.
044     * @param m The Marker to check.
045     * @return true of this Marker or one of its ancestors is the specified Marker, false otherwise.
046     */
047    boolean isInstanceOf(Marker m);
048
049    /**
050     * Checks whether this Marker is an instance of the specified Marker.
051     * @param name The name of the Marker.
052     * @return true of this Marker or one of its ancestors matches the specified name, false otherwise.
053     */
054    boolean isInstanceOf(String name);
055}