Tabnine Logo
Tuple3.getT2
Code IndexAdd Tabnine to your IDE (free)

How to use
getT2
method
in
reactor.util.function.Tuple3

Best Java code snippets using reactor.util.function.Tuple3.getT2 (Showing top 20 results out of 315)

origin: reactor/reactor-core

  @Override
  public String getMessage() {
    //skip the "error has been observed" traceback if mapped traceback is empty
    synchronized (chainOrder) {
      if (chainOrder.isEmpty()) {
        return super.getMessage();
      }
      StringBuilder sb = new StringBuilder(super.getMessage()).append(
          "Error has been observed by the following operator(s):\n");
      for(Tuple3<Integer, String, Integer> t : chainOrder) {
        //noinspection ConstantConditions
        mapLine(t.getT3(), sb, t.getT2());
      }
      return sb.toString();
    }
  }
}
origin: spring-projects/spring-framework

/**
 * Combine query params and form data for multipart form data from the body
 * of the request into a {@code Map<String, Object>} of values to use for
 * data binding purposes.
 * @param exchange the current exchange
 * @return a {@code Mono} with the values to bind
 * @see org.springframework.http.server.reactive.ServerHttpRequest#getQueryParams()
 * @see ServerWebExchange#getFormData()
 * @see ServerWebExchange#getMultipartData()
 */
public static Mono<Map<String, Object>> extractValuesToBind(ServerWebExchange exchange) {
  MultiValueMap<String, String> queryParams = exchange.getRequest().getQueryParams();
  Mono<MultiValueMap<String, String>> formData = exchange.getFormData();
  Mono<MultiValueMap<String, Part>> multipartData = exchange.getMultipartData();
  return Mono.zip(Mono.just(queryParams), formData, multipartData)
      .map(tuple -> {
        Map<String, Object> result = new TreeMap<>();
        tuple.getT1().forEach((key, values) -> addBindValue(result, key, values));
        tuple.getT2().forEach((key, values) -> addBindValue(result, key, values));
        tuple.getT3().forEach((key, values) -> addBindValue(result, key, values));
        return result;
      });
}
origin: reactor/reactor-core

@Test
public void fn3() {
  Integer[] source = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  Tuple3<Object, Object, Object> tuple = Tuples.fn3().apply(source);
  assertThat(tuple.getT1()).isEqualTo(1);
  assertThat(tuple.getT2()).isEqualTo(2);
  assertThat(tuple.getT3()).isEqualTo(3);
  assertThat(tuple)
      .isInstanceOf(Tuple8.class)
      .containsExactly(1, 2, 3, 4, 5, 6, 7, 8);
}
origin: reactor/reactor-core

@Test
public void fn3Delegate() {
  Integer[] source = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  Function<Tuple3<Integer, Integer, Integer>, Tuple3> invert = t3 -> new Tuple3<>(t3.getT3(), t3.getT2(), t3.getT1());
  Tuple3 tuple = Tuples.fn3(invert).apply(source);
  assertThat(tuple.getT1()).isEqualTo(3);
  assertThat(tuple.getT2()).isEqualTo(2);
  assertThat(tuple.getT3()).isEqualTo(1);
  assertThat((Object) tuple).isExactlyInstanceOf(Tuple3.class);
}
origin: spring-projects/spring-security

Mono<Request> createDefaultedRequest(String clientRegistrationId,
    Authentication authentication, ServerWebExchange exchange) {
  Mono<Authentication> defaultedAuthentication = Mono.justOrEmpty(authentication)
      .switchIfEmpty(currentAuthentication());
  Mono<String> defaultedRegistrationId = Mono.justOrEmpty(clientRegistrationId)
      .switchIfEmpty(Mono.justOrEmpty(this.defaultClientRegistrationId))
      .switchIfEmpty(clientRegistrationId(defaultedAuthentication));
  Mono<Optional<ServerWebExchange>> defaultedExchange = Mono.justOrEmpty(exchange)
      .switchIfEmpty(currentServerWebExchange()).map(Optional::of)
      .defaultIfEmpty(Optional.empty());
  return Mono.zip(defaultedRegistrationId, defaultedAuthentication, defaultedExchange)
      .map(t3 -> new Request(t3.getT1(), t3.getT2(), t3.getT3().orElse(null)));
}
origin: spring-projects/spring-security

Mono<Request> createDefaultedRequest(String clientRegistrationId,
    Authentication authentication, ServerWebExchange exchange) {
  Mono<Authentication> defaultedAuthentication = Mono.justOrEmpty(authentication)
      .switchIfEmpty(currentAuthentication());
  Mono<String> defaultedRegistrationId = Mono.justOrEmpty(clientRegistrationId)
      .switchIfEmpty(Mono.justOrEmpty(this.defaultClientRegistrationId))
      .switchIfEmpty(clientRegistrationId(defaultedAuthentication))
      .switchIfEmpty(Mono.error(() -> new IllegalArgumentException("The clientRegistrationId could not be resolved. Please provide one")));
  Mono<Optional<ServerWebExchange>> defaultedExchange = Mono.justOrEmpty(exchange)
      .switchIfEmpty(currentServerWebExchange()).map(Optional::of)
      .defaultIfEmpty(Optional.empty());
  return Mono.zip(defaultedRegistrationId, defaultedAuthentication, defaultedExchange)
      .map(t3 -> new Request(t3.getT1(), t3.getT2(), t3.getT3().orElse(null)));
}
origin: org.springframework/spring-web

/**
 * Combine query params and form data for multipart form data from the body
 * of the request into a {@code Map<String, Object>} of values to use for
 * data binding purposes.
 * @param exchange the current exchange
 * @return a {@code Mono} with the values to bind
 * @see org.springframework.http.server.reactive.ServerHttpRequest#getQueryParams()
 * @see ServerWebExchange#getFormData()
 * @see ServerWebExchange#getMultipartData()
 */
public static Mono<Map<String, Object>> extractValuesToBind(ServerWebExchange exchange) {
  MultiValueMap<String, String> queryParams = exchange.getRequest().getQueryParams();
  Mono<MultiValueMap<String, String>> formData = exchange.getFormData();
  Mono<MultiValueMap<String, Part>> multipartData = exchange.getMultipartData();
  return Mono.zip(Mono.just(queryParams), formData, multipartData)
      .map(tuple -> {
        Map<String, Object> result = new TreeMap<>();
        tuple.getT1().forEach((key, values) -> addBindValue(result, key, values));
        tuple.getT2().forEach((key, values) -> addBindValue(result, key, values));
        tuple.getT3().forEach((key, values) -> addBindValue(result, key, values));
        return result;
      });
}
origin: reactor/reactor-core

@Test
public void whenMonoJust3() {
  MonoProcessor<Tuple3<Integer, Integer, Integer>> mp = MonoProcessor.create();
  StepVerifier.create(Mono.zip(Mono.just(1), Mono.just(2), Mono.just(3))
              .subscribeWith(mp))
        .then(() -> assertThat(mp.isError()).isFalse())
        .then(() -> assertThat(mp.isSuccess()).isTrue())
        .then(() -> assertThat(mp.isTerminated()).isTrue())
        .assertNext(v -> assertThat(v.getT1() == 1 && v.getT2() == 2 && v.getT3() == 3).isTrue())
        .verifyComplete();
}
origin: reactor/reactor-core

@Test
public void whenDelayJustMono3() {
  MonoProcessor<Tuple3<Integer, Integer, Integer>> mp = MonoProcessor.create();
  StepVerifier.create(Mono.zipDelayError(Mono.just(1), Mono.just(2), Mono.just(3))
              .subscribeWith(mp))
        .then(() -> assertThat(mp.isError()).isFalse())
        .then(() -> assertThat(mp.isSuccess()).isTrue())
        .then(() -> assertThat(mp.isTerminated()).isTrue())
        .assertNext(v -> assertThat(v.getT1() == 1 && v.getT2() == 2 && v.getT3() == 3).isTrue())
        .verifyComplete();
}
origin: reactor/reactor-core

@Test
public void tupleProvidesTypeSafeMethods() {
  Tuple3<String, Long, Integer> t3 = Tuples.of("string", 1L, 10);
  assertThat(t3.getT1()).as("first value is a string").isInstanceOf(String.class);
  assertThat(t3.getT2()).as("second value is a long").isInstanceOf(Long.class);
  assertThat(t3.getT3()).as("third value is an int").isInstanceOf(Integer.class);
}
origin: reactor/reactor-core

@Test
public void mapT3() {
  Tuple3<Integer, Integer, String> base = Tuples.of(100, 200, "Foo");
  Tuple2<?,?> mapped = base.mapT3(String::length);
  assertThat(mapped).isNotSameAs(base)
           .hasSize(3)
           .containsExactly(base.getT1(), base.getT2(), 3);
}
origin: reactor/reactor-core

@Test
public void mapT1() {
  Tuple3<String, Integer, Integer> base = Tuples.of("Foo", 200, 300);
  Tuple2<?,?> mapped = base.mapT1(String::length);
  assertThat(mapped).isNotSameAs(base)
           .hasSize(3)
           .containsExactly(3, base.getT2(), base.getT3());
}
origin: reactor/reactor-core

assertThat(finalizeStats).areAtLeast(5, hasFinalized);
assertThat(finalizeStats).allMatch(t3 -> t3.getT2() <= 3, "max 3 windows in flight");
origin: reactor/reactor-core

@Test
public void nonPairWisePairWise() {
  Flux<Tuple2<Tuple3<Integer, String, String>, String>> f =
      Flux.zip(Flux.just(1), Flux.just("test"), Flux.just("test0"))
        .zipWith(Flux.just("test2"));
  Assert.assertTrue(f instanceof FluxZip);
  FluxZip<?, ?> s = (FluxZip<?, ?>) f;
  Assert.assertTrue(s.sources != null);
  Assert.assertTrue(s.sources.length == 2);
  Flux<Tuple2<Integer, String>> ff = f.map(t -> Tuples.of(t.getT1()
                               .getT1(),
      t.getT1()
       .getT2() + t.getT2()));
  ff.subscribeWith(AssertSubscriber.create())
   .assertValues(Tuples.of(1, "testtest2"))
   .assertComplete();
}
origin: naturalprogrammer/spring-lemon

public U resetPassword(Tuple3<U, JWTClaimsSet, String> tuple) {
  
  log.debug("Resetting password ...");
  U user = tuple.getT1();
  JWTClaimsSet claims = tuple.getT2();
  String newPassword = tuple.getT3();
  
  LerUtils.ensureCredentialsUpToDate(claims, user);
  
  // sets the password
  user.setPassword(passwordEncoder.encode(newPassword));
  user.setCredentialsUpdatedMillis(System.currentTimeMillis());
  
  log.debug("Password reset.");
  
  return user;
}
origin: io.projectreactor.addons/reactor-extra

/**
 * Returns a {@link Consumer} of {@link Tuple3} that wraps a consumer of the component values of the tuple
 *
 * @param consumer the component value consumer
 * @param <T1>     the type of the first value
 * @param <T2>     the type of the second value
 * @param <T3>     the type of the third value
 * @return the wrapper consumer
 */
public static <T1, T2, T3> Consumer<Tuple3<T1, T2, T3>> consumer(Consumer3<T1, T2, T3> consumer) {
  return tuple -> consumer.accept(tuple.getT1(), tuple.getT2(), tuple.getT3());
}
origin: io.projectreactor.addons/reactor-extra

/**
 * Returns a {@link Predicate} of {@link Tuple3} that wraps a predicate of the component values of the tuple
 *
 * @param predicate the component value predicate
 * @param <T1>      the type of the first value
 * @param <T2>      the type of the second value
 * @param <T3>      the type of the third value
 * @return the wrapper predicate
 */
public static <T1, T2, T3> Predicate<Tuple3<T1, T2, T3>> predicate(Predicate3<T1, T2, T3> predicate) {
  return tuple -> predicate.test(tuple.getT1(), tuple.getT2(), tuple.getT3());
}
origin: naturalprogrammer/spring-lemon

public Mono<UserDto> updateUser(ID userId, Mono<String> patch) {
  
  return Mono.zip(findUserById(userId), LecrUtils.currentUser(), patch)
    .doOnNext(this::ensureEditable)
    .map((Tuple3<U, Optional<UserDto>, String> tuple3) ->
      this.updateUser(tuple3.getT1(), tuple3.getT2(), tuple3.getT3()))
    .flatMap(userRepository::save)
    .map(user -> {
      UserDto userDto = user.toUserDto();
      userDto.setPassword(null);
      return userDto;
    });
}
origin: spring-projects/sts4

public Flux<Tuple2<IType, Double>> fuzzySearchTypes(String searchTerm, Predicate<IType> typeFilter) {
  return fuzzySearchTypes(searchTerm)
      .map(match -> Tuples.of(createType(Tuples.of(match.getT1(), match.getT2())), match.getT3()))
      .filter(t -> typeFilter == null || typeFilter.test(t.getT1()));
}
origin: akarnokd/akarnokd-misc

  public static void main(String[] args) {
    Publisher<Integer> source = Px.just(1).hide();
    Flux.zip(source, source, source).doOnNext(v -> System.out.println(v.getT1() + ", " + v.getT2() + ", " + v.getT3())).subscribe();
  }
}
reactor.util.functionTuple3getT2

Popular methods of Tuple3

  • getT1
  • getT3
    Type-safe way to get the third object of this Tuples.
  • <init>
  • hashCode
  • equals
  • get
  • mapT1
    Map the 1st part (T1) of this Tuple3 into a different value and type, keeping the other parts.
  • mapT2
    Map the 2nd part (T2) of this Tuple3 into a different value and type, keeping the other parts.
  • mapT3
    Map the 3rd part (T3) of this Tuple3 into a different value and type, keeping the other parts.
  • toArray
  • toString
  • toString

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • getExternalFilesDir (Context)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now