Package com.io7m.jproperties.monad
Class JPropertyFailure.Builder<A>
java.lang.Object
com.io7m.jproperties.monad.JPropertyFailure.Builder<A>
- Enclosing class:
- JPropertyFailure<A>
public static final class JPropertyFailure.Builder<A>
extends java.lang.Object
Builds instances of type
JPropertyFailure.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and Type Method Description JPropertyFailure.Builder<A>addAllErrors(java.lang.Iterable<? extends JPropertyError> elements)Adds elements toerrorslist.JPropertyFailure.Builder<A>addAllWarnings(java.lang.Iterable<? extends JPropertyWarning> elements)Adds elements towarningslist.JPropertyFailure.Builder<A>addErrors(JPropertyError element)Adds one element toerrorslist.JPropertyFailure.Builder<A>addErrors(JPropertyError... elements)Adds elements toerrorslist.JPropertyFailure.Builder<A>addWarnings(JPropertyWarning element)Adds one element towarningslist.JPropertyFailure.Builder<A>addWarnings(JPropertyWarning... elements)Adds elements towarningslist.JPropertyFailure<A>build()Builds a newJPropertyFailure.JPropertyFailure.Builder<A>from(JPropertyParseMonadType.JPropertyFailureType<A> instance)Fill a builder with attribute values from the providedJPropertyFailureTypeinstance.JPropertyFailure.Builder<A>setErrors(java.lang.Iterable<? extends JPropertyError> elements)Sets or replaces all elements forerrorslist.JPropertyFailure.Builder<A>setException(java.lang.Exception exception)Initializes the value for theexceptionattribute.JPropertyFailure.Builder<A>setWarnings(java.lang.Iterable<? extends JPropertyWarning> elements)Sets or replaces all elements forwarningslist.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
from
public final JPropertyFailure.Builder<A> from(JPropertyParseMonadType.JPropertyFailureType<A> instance)Fill a builder with attribute values from the providedJPropertyFailureTypeinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
addWarnings
Adds one element towarningslist.- Parameters:
element- A warnings element- Returns:
thisbuilder for use in a chained invocation
-
addWarnings
Adds elements towarningslist.- Parameters:
elements- An array of warnings elements- Returns:
thisbuilder for use in a chained invocation
-
setWarnings
public final JPropertyFailure.Builder<A> setWarnings(java.lang.Iterable<? extends JPropertyWarning> elements)Sets or replaces all elements forwarningslist.- Parameters:
elements- An iterable of warnings elements- Returns:
thisbuilder for use in a chained invocation
-
addAllWarnings
public final JPropertyFailure.Builder<A> addAllWarnings(java.lang.Iterable<? extends JPropertyWarning> elements)Adds elements towarningslist.- Parameters:
elements- An iterable of warnings elements- Returns:
thisbuilder for use in a chained invocation
-
addErrors
Adds one element toerrorslist.- Parameters:
element- A errors element- Returns:
thisbuilder for use in a chained invocation
-
addErrors
Adds elements toerrorslist.- Parameters:
elements- An array of errors elements- Returns:
thisbuilder for use in a chained invocation
-
setErrors
public final JPropertyFailure.Builder<A> setErrors(java.lang.Iterable<? extends JPropertyError> elements)Sets or replaces all elements forerrorslist.- Parameters:
elements- An iterable of errors elements- Returns:
thisbuilder for use in a chained invocation
-
addAllErrors
public final JPropertyFailure.Builder<A> addAllErrors(java.lang.Iterable<? extends JPropertyError> elements)Adds elements toerrorslist.- Parameters:
elements- An iterable of errors elements- Returns:
thisbuilder for use in a chained invocation
-
setException
Initializes the value for theexceptionattribute.- Parameters:
exception- The value for exception- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newJPropertyFailure.- Returns:
- An immutable instance of JPropertyFailure
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-