All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.mrapp.parser.feed.common.builder.AbstractLoggingParserBuilder Maven / Gradle / Ivy

The newest version!
/*
 * JavaFeedParserCommon Copyright 2013-2014 Michael Rapp
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see . 
 */
package de.mrapp.parser.feed.common.builder;

import de.mrapp.parser.feed.common.parser.AbstractLoggingParser;

/**
 * An abstract base class for all builders, which allow to create parsers, which
 * are able to use logging. Such parsers are represented by subclasses of the
 * class {@link AbstractLoggingParser}.
 * 
 * @param 
 *            The type of the parser, which should be created by the builder
 * @param 
 *            The result type of each method, which allows to configure the
 *            builder
 * 
 * @author Michael Rapp
 * 
 * @since 1.0.0
 */
public abstract class AbstractLoggingParserBuilder, BuilderType extends AbstractLoggingParserBuilder>
		extends AbstractBuilder {

	/**
	 * True, if the parsers, which are created by the builder, should use
	 * logging, false otherwise.
	 */
	private boolean loggingEnabled;

	/**
	 * Creates a new builder, which allows to create parsers, which are able to
	 * use logging. The parsers, which are created by the builder, do not use
	 * logging by default.
	 */
	public AbstractLoggingParserBuilder() {
		enableLogging(false);
	}

	/**
	 * Returns, whether the parsers, which are created by the builder, use
	 * logging, or not.
	 * 
	 * @return True, if the parsers, which are created by the builder, use
	 *         logging, false otherwise
	 */
	public final boolean isLoggingEnabled() {
		return loggingEnabled;
	}

	/**
	 * Sets, whether the parsers, which are created by the builder, should use
	 * logging, or not.
	 * 
	 * @param enable
	 *            True, if the parsers, which are created by the builder, should
	 *            use logging, false otherwise
	 * @return The builder, which has been configured by this method, as an
	 *         instance of the type BuilderType
	 */
	public final BuilderType enableLogging(final boolean enable) {
		this.loggingEnabled = enable;
		return self();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy