/** * Specifies an exact match and then returns a fluent interface for specifying the action to take * if the value matches this case. */ public <U extends T> OngoingMatchingC0<T, U> when(MatchesExact<U> o) { List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.eq(o.t)); return new OngoingMatchingC0<>( this, new DecomposableMatchBuilder0<>(matchers, new IdentityFieldExtractor<U>()).build()); }
/** * Specifies an exact match and then returns a fluent interface for specifying the action to take * if the value matches this case. */ public <U extends T> InitialMatching0<T, U> when(MatchesExact<U> o) { List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.eq(o.t)); return new InitialMatching0<>( new DecomposableMatchBuilder0<>(matchers, new IdentityFieldExtractor<U>()).build(), value); }
/** * Specifies an exact match and then returns a fluent interface for specifying the action to take * if the value matches this case. */ public <U extends T> OngoingMatchingR0<T, U, R> when(MatchesExact<U> o) { List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.eq(o.t)); return new OngoingMatchingR0<>( this, new DecomposableMatchBuilder0<>(matchers, new IdentityFieldExtractor<U>()).build()); }
/** * Specifies a wildcard match and then returns a fluent interface for specifying the action to * take if the value matches this case. */ public <U extends T> InitialMatching1<T, U, U> when(MatchesAny<U> o) { List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.any()); return new InitialMatching1<>( new DecomposableMatchBuilder1<U, U>(matchers, 0, new IdentityFieldExtractor<>()).build(), value); }
/** * Specifies a wildcard match and then returns a fluent interface for specifying the action to * take if the value matches this case. */ public <U extends T> OngoingMatchingR1<T, U, U, R> when(MatchesAny<U> o) { List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.any()); return new OngoingMatchingR1<>( this, new DecomposableMatchBuilder1<U, U>(matchers, 0, new IdentityFieldExtractor<>()).build()); }
/** * Specifies a wildcard match and then returns a fluent interface for specifying the action to * take if the value matches this case. */ public <U extends T> OngoingMatchingC1<T, U, U> when(MatchesAny<U> o) { List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.any()); return new OngoingMatchingC1<>( this, new DecomposableMatchBuilder1<U, U>(matchers, 0, new IdentityFieldExtractor<>()).build()); }