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

com.adobe.reef.siren.builder.Builder Maven / Gradle / Ivy

There is a newer version: 2024.11.18598.20241113T125352Z-241000
Show newest version
/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2014 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/
package com.adobe.reef.siren.builder;

/**
 * {@code Builder} is used to build instances of {@code } from values
 * configured by the setters.
 * 

* Builders can be reused, {@code clear()} resets all fields to their default values. *

* @param */ public abstract class Builder { /** * Builds the instance {@code T} after validating the values. * * @return * @throws BuilderException if something goes wrong during build */ public T build() throws BuilderException { T instance = doBuild(); validate(instance); return instance; } /** * Resets all fields to their default values. */ public abstract Builder clear(); /** * Builds the instance {@code T}. * * @return * @throws BuilderException if something goes wrong during build */ protected abstract T doBuild() throws BuilderException; /** * Validates an {@code instance} * * @param instance * @throws BuilderValidationException if a value is not valid or missing */ protected abstract void validate(T instance) throws BuilderValidationException; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy