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 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 Details

    • from

      Fill a builder with attribute values from the provided JPropertyFailureType instance. 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:
      this builder for use in a chained invocation
    • setException

      public final JPropertyFailure.Builder<A> setException(Exception exception)
      Initializes the value for the exception attribute.
      Parameters:
      exception - The value for exception
      Returns:
      this builder for use in a chained invocation
    • addWarnings

      public final JPropertyFailure.Builder<A> addWarnings(JPropertyWarning element)
      Adds one element to warnings list.
      Parameters:
      element - A warnings element
      Returns:
      this builder for use in a chained invocation
    • addWarnings

      public final JPropertyFailure.Builder<A> addWarnings(JPropertyWarning... elements)
      Adds elements to warnings list.
      Parameters:
      elements - An array of warnings elements
      Returns:
      this builder for use in a chained invocation
    • setWarnings

      public final JPropertyFailure.Builder<A> setWarnings(Iterable<? extends JPropertyWarning> elements)
      Sets or replaces all elements for warnings list.
      Parameters:
      elements - An iterable of warnings elements
      Returns:
      this builder for use in a chained invocation
    • addAllWarnings

      public final JPropertyFailure.Builder<A> addAllWarnings(Iterable<? extends JPropertyWarning> elements)
      Adds elements to warnings list.
      Parameters:
      elements - An iterable of warnings elements
      Returns:
      this builder for use in a chained invocation
    • addErrors

      public final JPropertyFailure.Builder<A> addErrors(JPropertyError element)
      Adds one element to errors list.
      Parameters:
      element - A errors element
      Returns:
      this builder for use in a chained invocation
    • addErrors

      public final JPropertyFailure.Builder<A> addErrors(JPropertyError... elements)
      Adds elements to errors list.
      Parameters:
      elements - An array of errors elements
      Returns:
      this builder for use in a chained invocation
    • setErrors

      public final JPropertyFailure.Builder<A> setErrors(Iterable<? extends JPropertyError> elements)
      Sets or replaces all elements for errors list.
      Parameters:
      elements - An iterable of errors elements
      Returns:
      this builder for use in a chained invocation
    • addAllErrors

      public final JPropertyFailure.Builder<A> addAllErrors(Iterable<? extends JPropertyError> elements)
      Adds elements to errors list.
      Parameters:
      elements - An iterable of errors elements
      Returns:
      this builder for use in a chained invocation
    • build

      public JPropertyFailure<A> build()
      Builds a new JPropertyFailure.
      Returns:
      An immutable instance of JPropertyFailure
      Throws:
      IllegalStateException - if any required attributes are missing