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.