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 java.lang.Object implements JPropertyParseMonadType.JPropertySuccessType<A>
A result indicating success.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJPropertySuccess.Builder<A>Builds instances of typeJPropertySuccess.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 Type Method Description static <A> JPropertySuccess.Builder<A>builder()Creates a builder forJPropertySuccess.static <A> JPropertySuccess<A>copyOf(JPropertyParseMonadType.JPropertySuccessType<A> instance)Creates an immutable copy of aJPropertyParseMonadType.JPropertySuccessTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofJPropertySuccessthat have equal attribute values.java.util.List<JPropertyError>errors()inthashCode()Computes a hash code from attributes:warnings,errors,result.Aresult()java.lang.StringtoString()Prints the immutable valueJPropertySuccesswith attribute values.java.util.List<JPropertyWarning>warnings()JPropertySuccess<A>withErrors(JPropertyError... elements)Copy the current immutable object with elements that replace the content oferrors.JPropertySuccess<A>withErrors(java.lang.Iterable<? extends JPropertyError> elements)Copy the current immutable object with elements that replace the content oferrors.JPropertySuccess<A>withResult(A value)Copy the current immutable object by setting a value for theresultattribute.JPropertySuccess<A>withWarnings(JPropertyWarning... elements)Copy the current immutable object with elements that replace the content ofwarnings.JPropertySuccess<A>withWarnings(java.lang.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, waitMethods inherited from interface com.io7m.jproperties.monad.JPropertyParseMonadType
andThenMethods inherited from interface com.io7m.jproperties.monad.JPropertyParseMonadType.JPropertySuccessType
flatMap, kind, map
-
Method Details
-
warnings
- Specified by:
warningsin interfaceJPropertyParseMonadType<A>- Returns:
- The accumulated warnings
-
errors
- Specified by:
errorsin interfaceJPropertyParseMonadType<A>- Returns:
- The accumulated errors
-
result
- Specified by:
resultin interfaceJPropertyParseMonadType.JPropertySuccessType<A>- Returns:
- The result of parsing
-
withWarnings
Copy the current immutable object with elements that replace the content ofwarnings.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withWarnings
public final JPropertySuccess<A> withWarnings(java.lang.Iterable<? extends JPropertyWarning> elements)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
thisobject
-
withErrors
Copy the current immutable object with elements that replace the content oferrors.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
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
thisobject
-
withResult
Copy the current immutable object by setting a value for theresultattribute. 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
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofJPropertySuccessthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:warnings,errors,result.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueJPropertySuccesswith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static <A> JPropertySuccess<A> copyOf(JPropertyParseMonadType.JPropertySuccessType<A> instance)Creates an immutable copy of aJPropertyParseMonadType.JPropertySuccessTypevalue. 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.JPropertySuccess.<A>builder() .addWarnings|addAllWarnings(JPropertyWarning) //warningselements .addErrors|addAllErrors(JPropertyError) //errorselements .setResult(A) // requiredresult.build();- Type Parameters:
A- generic parameter A- Returns:
- A new JPropertySuccess builder
-