Package de.xima.fc.common.data.algebraic
Class OneOfN.None
- java.lang.Object
-
- de.xima.fc.common.data.algebraic.OneOfN
-
- de.xima.fc.common.data.algebraic.OneOfN.None
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- OneOfN
public static final class OneOfN.None extends OneOfN
Emulates a sum type consisting of 0 cases.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.xima.fc.common.data.algebraic.OneOfN
OneOfN.Either<T1,T2>, OneOfN.EitherMatcher<R,T1,T2>, OneOfN.Just<T1>, OneOfN.JustMatcher<R,T1>, OneOfN.None, OneOfN.NoneMatcher<R>, OneOfN.OneOf3<T1,T2,T3>, OneOfN.OneOf3Matcher<R,T1,T2,T3>, OneOfN.OneOf4<T1,T2,T3,T4>, OneOfN.OneOf4Matcher<R,T1,T2,T3,T4>, OneOfN.OneOf5<T1,T2,T3,T4,T5>, OneOfN.OneOf5Matcher<R,T1,T2,T3,T4,T5>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VoidgetValue()Checks which case applies and returns the value for that case.static OneOfN.Noneinstance()OneOfN.Nonemap()Maps this sum type to another sum type by invoking the mapping function for the matching case with the value of this sum type and returning the result.<R> Rmatch()Performs a case match on this sum type by invoking the mapping function for the matching case with the value of this sum type and returning the result.<R> Rmatch(R defaultValue, OneOfN.NoneMatcher<? extends R> matcher)Performs a case match on this sum type by invoking the mapping function for the matching case with the value of this sum type and returning the result.
-
-
-
Method Detail
-
getValue
public Void getValue()
Description copied from class:OneOfNChecks which case applies and returns the value for that case. You need to cast it yourself to the required type.
-
map
public OneOfN.None map()
Maps this sum type to another sum type by invoking the mapping function for the matching case with the value of this sum type and returning the result.- Returns:
- The sum type with the value returned by the mapping function for the matching case.
-
match
public <R> R match()
Performs a case match on this sum type by invoking the mapping function for the matching case with the value of this sum type and returning the result.- Type Parameters:
R- Type of the result returned by each mapping function.- Returns:
- The value returned by the mapping function for the matching case.
-
match
public <R> R match(R defaultValue, OneOfN.NoneMatcher<? extends R> matcher)Performs a case match on this sum type by invoking the mapping function for the matching case with the value of this sum type and returning the result.- Type Parameters:
R- Type of the result returned by each mapping function.- Parameters:
defaultValue- Value returned when the given matcher has no matching case.matcher- Matcher object for each case.- Returns:
- The value returned by the mapping function for the matching case.
-
instance
public static OneOfN.None instance()
- Returns:
- The single instance of this bottom type.
-
-