View Javadoc
1   /*
2    * Copyright 2018 SPF4J.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.slf4j.impl;
17  
18  import org.slf4j.IMarkerFactory;
19  import org.slf4j.helpers.BasicMarkerFactory;
20  import org.slf4j.spi.MarkerFactoryBinder;
21  
22  /**
23   * @author Zoltan Farkas
24   */
25  public final class StaticMarkerBinder implements MarkerFactoryBinder {
26  
27    /**
28     * The unique instance of this class.
29     */
30    public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
31  
32    private final IMarkerFactory markerFactory = new BasicMarkerFactory();
33  
34    private StaticMarkerBinder() {
35    }
36  
37    /**
38     * Return the singleton of this class.
39     *
40     * @return the StaticMarkerBinder singleton
41     * @since 1.7.14
42     */
43    public static StaticMarkerBinder getSingleton() {
44      return SINGLETON;
45    }
46  
47    /**
48     * Currently this method always returns an instance of {@link BasicMarkerFactory}.
49     */
50    public IMarkerFactory getMarkerFactory() {
51      return markerFactory;
52    }
53  
54    /**
55     * Currently, this method returns the class name of {@link BasicMarkerFactory}.
56     */
57    public String getMarkerFactoryClassStr() {
58      return BasicMarkerFactory.class.getName();
59    }
60  
61    @Override
62    public String toString() {
63      return "StaticMarkerBinder{" + "markerFactory=" + markerFactory + '}';
64    }
65  
66  }