View Javadoc

1   /*
2    * This file is part of AceLogger.
3    * 
4    * AceLogger is free software: you can redistribute it and/or modify it under the terms of the GNU
5    * Lesser General Public License as published by the Free Software Foundation, either version 3 of
6    * the License, or (at your option) any later version.
7    * 
8    * AceLogger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9    * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10   * Lesser General Public License for more details.
11   * 
12   * You should have received a copy of the GNU Lesser General Public License along with AceLogger.
13   * If not, see <http://www.gnu.org/licenses/lgpl-3.0.html>.
14   */
15  package net.sourceforge.acelogger.level.filter;
16  
17  /**
18   * Abstracts all common tasks for {@link LevelFilter}.
19   * 
20   * @author Zardi (https://sourceforge.net/users/daniel_zardi)
21   * @version 1.0.0
22   * @since 1.0.0
23   */
24  public abstract class BaseLevelFilter implements LevelFilter {
25  
26  	/**
27  	 * The identifier of this filter.
28  	 */
29  	private String identifier;
30  
31  	/**
32  	 * Constructs a new BaseLevelFilter with the supplied identifier.
33  	 * 
34  	 * @param identifier
35  	 *            The identifier of this filter.
36  	 * @since 1.0.0
37  	 */
38  	public BaseLevelFilter(String identifier) {
39  		setIdentifier(identifier);
40  	}
41  
42  	/** {@inheritDoc} */
43  	public final String getIdentifier() {
44  		return identifier;
45  	}
46  
47  	/**
48  	 * Sets the string that identifies this object.
49  	 * 
50  	 * @param identifier
51  	 *            The identifier of this object.
52  	 * @since 1.0.0
53  	 */
54  	private void setIdentifier(String identifier) {
55  		if (identifier == null) {
56  			this.identifier = "";
57  		} else {
58  			this.identifier = identifier;
59  		}
60  	}
61  
62  }