Class JPropertyFailure<A>

java.lang.Object
com.io7m.jproperties.monad.JPropertyFailure<A>
Type Parameters:
A - The type of result values
All Implemented Interfaces:
JPropertyParseMonadType<A>, JPropertyParseMonadType.JPropertyFailureType<A>

public final class JPropertyFailure<A> extends Object implements JPropertyParseMonadType.JPropertyFailureType<A>
A result indicating failure.
  • Method Details

    • exception

      public Exception exception()
      Specified by:
      exception in interface JPropertyParseMonadType.JPropertyFailureType<A>
      Returns:
      The exception raised during parsing
    • warnings

      public List<JPropertyWarning> warnings()
      Specified by:
      warnings in interface JPropertyParseMonadType<A>
      Returns:
      The accumulated warnings
    • errors

      public List<JPropertyError> errors()
      Specified by:
      errors in interface JPropertyParseMonadType<A>
      Returns:
      The accumulated errors
    • withException

      public final JPropertyFailure<A> withException(Exception value)
      Copy the current immutable object by setting a value for the exception attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for exception
      Returns:
      A modified copy of the this object
    • withWarnings

      public final JPropertyFailure<A> withWarnings(JPropertyWarning... elements)
      Copy the current immutable object with elements that replace the content of warnings.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withWarnings

      public final JPropertyFailure<A> withWarnings(Iterable<? extends JPropertyWarning> elements)
      Copy the current immutable object with elements that replace the content of warnings. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of warnings elements to set
      Returns:
      A modified copy of this object
    • withErrors

      public final JPropertyFailure<A> withErrors(JPropertyError... elements)
      Copy the current immutable object with elements that replace the content of errors.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withErrors

      public final JPropertyFailure<A> withErrors(Iterable<? extends JPropertyError> elements)
      Copy the current immutable object with elements that replace the content of errors. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of errors elements to set
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of JPropertyFailure that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: exception, warnings, errors.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value JPropertyFailure with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static <A> JPropertyFailure<A> copyOf(JPropertyParseMonadType.JPropertyFailureType<A> instance)
      Creates an immutable copy of a JPropertyParseMonadType.JPropertyFailureType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      A - generic parameter A
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable JPropertyFailure instance
    • builder

      public static <A> JPropertyFailure.Builder<A> builder()
      Creates a builder for JPropertyFailure.
      Type Parameters:
      A - generic parameter A
      Returns:
      A new JPropertyFailure builder