org.nervousync.builder.AbstractBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utils-jdk11 Show documentation
Show all versions of utils-jdk11 Show documentation
Java utility collections, development by Nervousync Studio (NSYC)
/*
* Licensed to the Nervousync Studio (NSYC) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nervousync.builder;
import org.nervousync.exceptions.builder.BuilderException;
/**
* Abstract builder for Generics Type
* 拥有父构造器的抽象构造器
*
* @param Generics Type Class
* 泛型类
*
* @author Steven Wee [email protected]
* @version $Revision: 1.0.0 $ $Date: Jan 4, 2018 16:09:54 $
*/
public abstract class AbstractBuilder {
/**
* Generics Type Class
* 泛型类
*/
protected final T parentBuilder;
/**
* Protected constructor for AbstractBuilder
* AbstractBuilder的构造函数
*
* @param parentBuilder Generics Type instance
* 泛型类实例对象
*/
protected AbstractBuilder(final T parentBuilder) {
this.parentBuilder = parentBuilder;
}
/**
* Protected abstract method for build current configure
* 保护的抽象方法,用于构建当前配置信息
*
* @throws BuilderException
* If an occurs when build current configure
* 当构建当前配置时时捕获异常
*/
protected abstract void build() throws BuilderException;
/**
* Confirm current configure and return Generics Type instance
* 确认当前设置,并返回泛型类实例对象
*
* @return Generics Type Class
* 泛型类
* @throws BuilderException
* If an occurs when confirm current configure
* 当确认当前配置时时捕获异常
*/
public final T confirm() throws BuilderException {
this.build();
return this.parentBuilder;
}
}