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

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

/*
 * 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;

/**
 * An abstract base class for all builders, which allow to create and configure
 * instances of a specific type.
 * 
 * @param 
 *            The type of the instances, 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 AbstractBuilder> {

	/**
	 * Returns the builder itself, casted to the type BuilderType.
	 * 
	 * @return The builder itself as an instance of the type BuilderType
	 */
	@SuppressWarnings("unchecked")
	protected final BuilderType self() {
		return (BuilderType) this;
	}

	/**
	 * Creates and returns an instance of the type, which is created by the
	 * builder.
	 * 
	 * @return The instance, which has been created, as an instance of the type
	 *         ProductType
	 * @throws BuilderException
	 *             The exception, which is thrown, if an error occurs while
	 *             creating the instance
	 */
	public abstract ProductType build() throws BuilderException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy