1 /*
2 * Copyright (c) 2004-2005 SLF4J.ORG
3 * Copyright (c) 2004-2005 QOS.ch
4 *
5 * All rights reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, and/or sell copies of the Software, and to permit persons
12 * to whom the Software is furnished to do so, provided that the above
13 * copyright notice(s) and this permission notice appear in all copies of
14 * the Software and that both the above copyright notice(s) and this
15 * permission notice appear in supporting documentation.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
20 * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21 * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
22 * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
23 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
24 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
25 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26 *
27 * Except as contained in this notice, the name of a copyright holder
28 * shall not be used in advertising or otherwise to promote the sale, use
29 * or other dealings in this Software without prior written authorization
30 * of the copyright holder.
31 */
32
33
34 package org.slf4j.impl;
35
36 import org.slf4j.IMarkerFactory;
37 import org.slf4j.helpers.BasicMarkerFactory;
38 import org.slf4j.spi.MarkerFactoryBinder;
39
40 /**
41 * The binding of {@link org.slf4j.MarkerFactory} class with an actual instance
42 * of {@link IMarkerFactory} is performed using information returned by this
43 * class.
44 * <p>
45 *
46 * @author Ceki Gülcü
47 * @author <a href="mailto:acannone@imolinfo.it">Amedeo Cannone</a>
48 * @author <a href="mailto:mcimatti@imolinfo.it">Marco Cimatti</a>
49 */
50 public final class StaticMarkerBinder implements MarkerFactoryBinder {
51
52 /**
53 * The unique instance of this class.
54 */
55 public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
56
57 /**
58 * The <code>org.slf4j.IMarkerFactory</code> that this instance should bind
59 * to.
60 *
61 * @see #getMarkerFactory()
62 */
63 private final IMarkerFactory markerFactory = new BasicMarkerFactory();
64
65 /**
66 * Constructs a new instance of this class.
67 */
68 private StaticMarkerBinder() {
69 }
70
71 /**
72 * Return the instance of {@link IMarkerFactory} that
73 * {@link org.slf4j.MarkerFactory} class should bind to.
74 *
75 * @return an instance of {@link BasicMarkerFactory}.
76 */
77 public IMarkerFactory getMarkerFactory() {
78 return markerFactory;
79 }
80
81 /**
82 * The <code>String</code> form of the {@link IMarkerFactory} object that
83 * this <code>MarkerFactoryBinder</code> instance is <em>intended</em> to
84 * return.
85 * <p>
86 * This method allows the developer to interogate this binder's intention
87 * which may be different from the {@link IMarkerFactory} instance it is
88 * able to return. Such a discrepency should only occur in case of errors.
89 *
90 * @return the class name of {@link BasicMarkerFactory}.
91 */
92 public String getMarkerFactoryClassStr() {
93 return BasicMarkerFactory.class.getName();
94 }
95 }