net.sf.staccatocommons.lang.builder
Interface Builder<T>

Type Parameters:
T - The type of built object
All Known Subinterfaces:
ReusableBuilder<T>
All Known Implementing Classes:
AbstractReusableBuilder, CollectionBuilder, MapBuilder

public interface Builder<T>

Author:
flbulgarelli

Method Summary
 T build()
          Returns the built object.
 

Method Detail

build

T build()
        throws ObjectUnderConstructionException,
               BuilderAlreadyUsedException
Returns the built object.

Builders are not meant to be used more than once. So this method can only be invoked successfully one time. Subsequent invocations after a successful return will throw an BuilderAlreadyUsedException. However, implementors may relax this, and be reusable, that is being able to be used more than once; such implementors should document that feature.

Builders may impose restriction to the state of the object under construction. If such constraints are not met while invoking this method, a ObjectUnderConstructionException exception must be thrown.

Returns:
The built object.
Throws:
ObjectUnderConstructionException - If the object building process has not finished yet
BuilderAlreadyUsedException - If the building process has finished, but this method has already being invoked without throwing an exception.


Copyright © 2010-2012 Staccatocommons. All Rights Reserved.