public abstract class RequirementBuilder<T>
extends java.lang.Object
Requirement
.
Please note that one instance of this builder can be built exactly once.
Changed in 1.1.0: added type argument
Constructor and Description |
---|
RequirementBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract RequirementBuilder<T> |
add(RequirementCase<? super T> requirementCase)
Adds a
RequirementCase to this builder |
abstract RequirementBuilder<T> |
addAll(java.util.Collection<? extends RequirementCase<? super T>> requirementCases)
Adds a collection of
RequirementCase to this builder. |
abstract RequirementBuilder<T> |
addAllIf(boolean result,
java.util.Collection<? extends RequirementCase<? super T>> requirementCases)
Adds a collection of
RequirementCase to this builder. |
abstract RequirementBuilder<T> |
addIf(boolean result,
RequirementCase<? super T> requirementCase)
Adds a
RequirementCase to this builder only if `result` is true |
abstract Requirement |
build()
Please note that if no
RequirementCase were added, then build Requirement
will always be in `success` state |
static <T> RequirementBuilder<T> |
create(EventDispatcher<T> eventDispatcher,
EventSource eventSource)
Factory method to obtain an instance of
RequirementBuilder |
public static <T> RequirementBuilder<T> create(EventDispatcher<T> eventDispatcher, EventSource eventSource)
RequirementBuilder
RequirementBuilder
EventDispatcher
,
EventSource
public abstract RequirementBuilder<T> add(RequirementCase<? super T> requirementCase) throws java.lang.IllegalStateException
RequirementCase
to this builderrequirementCase
- RequirementCase
to addjava.lang.IllegalStateException
- if this builder instance had been built alreadypublic abstract RequirementBuilder<T> addIf(boolean result, RequirementCase<? super T> requirementCase) throws java.lang.IllegalStateException
RequirementCase
to this builder only if `result` is trueresult
- boolean to check if RequirementCase
should be addedrequirementCase
- RequirementCase
to add if `result` is truejava.lang.IllegalStateException
- if this builder instance had been built alreadypublic abstract RequirementBuilder<T> addAll(java.util.Collection<? extends RequirementCase<? super T>> requirementCases) throws java.lang.IllegalStateException
RequirementCase
to this builder. Please note that collection must
not contain `null` as elementsrequirementCases
- collection of RequirementCase
to addjava.lang.IllegalStateException
- if this builder instance had been built alreadypublic abstract RequirementBuilder<T> addAllIf(boolean result, java.util.Collection<? extends RequirementCase<? super T>> requirementCases) throws java.lang.IllegalStateException
RequirementCase
to this builder. Please note that collection must
not contain `null` as elements only if `result` is trueresult
- boolean to check if collection of RequirementCase
should be addedrequirementCases
- collection of RequirementCase
to add if `result` is truejava.lang.IllegalStateException
- if this builder instance had been built alreadypublic abstract Requirement build() throws java.lang.IllegalStateException
RequirementCase
were added, then build Requirement
will always be in `success` stateRequirement
java.lang.IllegalStateException
- if this builder instance had been built alreadyEventSource