| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ModelBuilder |
|
| 1.0;1 |
| 1 | package org.kuali.rice.core.api.mo; | |
| 2 | ||
| 3 | /** | |
| 4 | * This is an interface that defines a builder. A builder is an object used to | |
| 5 | * assemble and construct an instance of another object. Typically the object | |
| 6 | * being constructed will be an immutable object (and therefore does not | |
| 7 | * contain "setters" which can be used to mutate it's state). The builder | |
| 8 | * pattern is a creation pattern that can be used to aid in the construction of | |
| 9 | * these complex immutable objects. | |
| 10 | * | |
| 11 | * <p>This interface only defines a common {@link #build()} method which is | |
| 12 | * used to return an instance of the object once state has been set on the | |
| 13 | * builder to a point where construction of an object instance is deemed | |
| 14 | * acceptable by the client code. Definition of type-specific setter methods | |
| 15 | * are defined by the classes which implement this interface. | |
| 16 | * | |
| 17 | * <p>This version of the builder pattern is proposed by Joshua Bloch in his | |
| 18 | * book "Effective Java". See "Effective Java" 2nd ed. page 15 for more | |
| 19 | * information. | |
| 20 | * | |
| 21 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 22 | * | |
| 23 | */ | |
| 24 | public interface ModelBuilder { | |
| 25 | ||
| 26 | /** | |
| 27 | * Returns an instance of the object being built by this builder based | |
| 28 | * on the current state of the builder. It should be possible to | |
| 29 | * invoke this method more than once on the same builder. It should | |
| 30 | * never return null; | |
| 31 | * | |
| 32 | * @return an instance of the object being built by this builder, | |
| 33 | * should never return null | |
| 34 | */ | |
| 35 | Object build(); | |
| 36 | ||
| 37 | } |