Package com.io7m.jproperties.monad
Class JPropertySuccess<A>
java.lang.Object
com.io7m.jproperties.monad.JPropertySuccess<A>
- Type Parameters:
A
- The type of result values
- All Implemented Interfaces:
JPropertyParseMonadType<A>
,JPropertyParseMonadType.JPropertySuccessType<A>
public final class JPropertySuccess<A>
extends Object
implements JPropertyParseMonadType.JPropertySuccessType<A>
A result indicating success.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.io7m.jproperties.monad.JPropertyParseMonadType
JPropertyParseMonadType.JPropertyErrorType, JPropertyParseMonadType.JPropertyFailureType<A>, JPropertyParseMonadType.JPropertySuccessType<A>, JPropertyParseMonadType.JPropertyWarningType, JPropertyParseMonadType.Kind, JPropertyParseMonadType.Unit
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A> JPropertySuccess.Builder<A>
builder()
Creates a builder forJPropertySuccess
.static <A> JPropertySuccess<A>
copyOf
(JPropertyParseMonadType.JPropertySuccessType<A> instance) Creates an immutable copy of aJPropertyParseMonadType.JPropertySuccessType
value.boolean
This instance is equal to all instances ofJPropertySuccess
that have equal attribute values.errors()
int
hashCode()
Computes a hash code from attributes:result
,warnings
,errors
.result()
toString()
Prints the immutable valueJPropertySuccess
with attribute values.warnings()
final JPropertySuccess<A>
withErrors
(JPropertyError... elements) Copy the current immutable object with elements that replace the content oferrors
.final JPropertySuccess<A>
withErrors
(Iterable<? extends JPropertyError> elements) Copy the current immutable object with elements that replace the content oferrors
.final JPropertySuccess<A>
withResult
(A value) Copy the current immutable object by setting a value for theresult
attribute.final JPropertySuccess<A>
withWarnings
(JPropertyWarning... elements) Copy the current immutable object with elements that replace the content ofwarnings
.final JPropertySuccess<A>
withWarnings
(Iterable<? extends JPropertyWarning> elements) Copy the current immutable object with elements that replace the content ofwarnings
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.io7m.jproperties.monad.JPropertyParseMonadType
andThen
Methods inherited from interface com.io7m.jproperties.monad.JPropertyParseMonadType.JPropertySuccessType
flatMap, kind, map
-
Method Details
-
result
- Specified by:
result
in interfaceJPropertyParseMonadType.JPropertySuccessType<A>
- Returns:
- The result of parsing
-
warnings
- Specified by:
warnings
in interfaceJPropertyParseMonadType<A>
- Returns:
- The accumulated warnings
-
errors
- Specified by:
errors
in interfaceJPropertyParseMonadType<A>
- Returns:
- The accumulated errors
-
withResult
Copy the current immutable object by setting a value for theresult
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for result- Returns:
- A modified copy of the
this
object
-
withWarnings
Copy the current immutable object with elements that replace the content ofwarnings
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withWarnings
Copy the current immutable object with elements that replace the content ofwarnings
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of warnings elements to set- Returns:
- A modified copy of
this
object
-
withErrors
Copy the current immutable object with elements that replace the content oferrors
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withErrors
Copy the current immutable object with elements that replace the content oferrors
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of errors elements to set- Returns:
- A modified copy of
this
object
-
equals
This instance is equal to all instances ofJPropertySuccess
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:result
,warnings
,errors
. -
toString
Prints the immutable valueJPropertySuccess
with attribute values. -
copyOf
public static <A> JPropertySuccess<A> copyOf(JPropertyParseMonadType.JPropertySuccessType<A> instance) Creates an immutable copy of aJPropertyParseMonadType.JPropertySuccessType
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 JPropertySuccess instance
-
builder
Creates a builder forJPropertySuccess
.- Type Parameters:
A
- generic parameter A- Returns:
- A new JPropertySuccess builder
-