Class OneOfN.OneOf5<T1,T2,T3,T4,T5>
java.lang.Object
de.xima.fc.api.rest.pub.client.user_portal.OneOfN
de.xima.fc.api.rest.pub.client.user_portal.OneOfN.OneOf5<T1,T2,T3,T4,T5>
- Type Parameters:
T1- Type of the value for the first case.T2- Type of the value for the second case.T3- Type of the value for the third case.T4- Type of the value for the fourth case.T5- Type of the value for the fifth case.
- Enclosing class:
OneOfN
Emulates a sum type consisting of 5 cases.
-
Nested Class Summary
Nested classes/interfaces inherited from class 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> -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T1,T2, T3, T4, T5>
OneOfN.OneOf5<T1, T2, T3, T4, T5> fifth(T5 fifth) static <T1,T2, T3, T4, T5>
OneOfN.OneOf5<T1, T2, T3, T4, T5> first(T1 first) static <T1,T2, T3, T4, T5>
OneOfN.OneOf5<T1, T2, T3, T4, T5> fourth(T4 fourth) booleanisFifth()booleanisFirst()booleanisFourth()booleanisSecond()booleanisThird()<R> Rmatch(Function<T1, R> first, Function<T2, R> second, Function<T3, R> third, Function<T4, R> fourth, Function<T5, R> fifth) 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> RPerforms 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.mergeFirst(Function<T1, T2> combiner) Allows for a multi-stage reduce operation of the cases into a single value.Allows for a multi-stage reduce operation of the cases into a single value.static <T1,T2, T3, T4, T5>
OneOfN.OneOf5<T1, T2, T3, T4, T5> second(T2 second) static <T1,T2, T3, T4, T5>
OneOfN.OneOf5<T1, T2, T3, T4, T5> third(T3 third)
-
Method Details
-
match
public <R> R match(Function<T1, R> first, Function<T2, R> second, Function<T3, R> third, Function<T4, R> fourth, Function<T5, R> fifth) 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:
first- Mapping function for the first case.second- Mapping function for the second case.third- Mapping function for the third case.fourth- Mapping function for the fourth case.fifth- Mapping function for the fifth case.- Returns:
- The value returned by the mapping function for the matching case.
-
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.- 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.
-
mergeFirst
Allows for a multi-stage reduce operation of the cases into a single value. Reduces the number of cases by one by mapping the first to the second case via the given mapping function.- Parameters:
combiner- Mapping function that transform the value of the first case into the second case.- Returns:
- A sum type with one less case.
-
mergeLast
Allows for a multi-stage reduce operation of the cases into a single value. Reduces the number of cases by one by mapping the fifth to the fourth case via the given mapping function.- Parameters:
combiner- Mapping function that transform the value of the fifth case into the fourth case.- Returns:
- A sum type with one less case.
-
selectFirst
-
isFirst
public boolean isFirst()- Returns:
- Whether a value for the first case is present.
-
selectSecond
-
isSecond
public boolean isSecond()- Returns:
- Whether a value for the second case is present.
-
selectThird
-
isThird
public boolean isThird()- Returns:
- Whether a value for the third case is present.
-
selectFourth
-
isFourth
public boolean isFourth()- Returns:
- Whether a value for the fourth case is present.
-
selectFifth
-
isFifth
public boolean isFifth()- Returns:
- Whether a value for the fifth case is present.
-
first
- Parameters:
first- The value for the first case.- Returns:
- A new sum type with the value for the first case.
-
second
- Parameters:
second- The value for the second case.- Returns:
- A new sum type with the value for the second case.
-
third
- Parameters:
third- The value for the third case.- Returns:
- A new sum type with the value for the third case.
-
fourth
- Parameters:
fourth- The value for the fourth case.- Returns:
- A new sum type with the value for the fourth case.
-
fifth
- Parameters:
fifth- The value for the fifth case.- Returns:
- A new sum type with the value for the fifth case.
-