Java Code Examples for io.reactivex.Maybe#map()
The following examples show how to use
io.reactivex.Maybe#map() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaybeUnmarshaller.java From vertx-rx with Apache License 2.0 | 6 votes |
@Override public MaybeSource<T> apply(@NonNull Maybe<B> upstream) { Maybe<Buffer> unwrapped = upstream.map(unwrap::apply); Maybe<T> unmarshalled = unwrapped.concatMap(buffer -> { if (buffer.length() > 0) { try { T obj; if (mapper != null) { JsonParser parser = mapper.getFactory().createParser(buffer.getBytes()); obj = nonNull(mappedType) ? mapper.readValue(parser, mappedType) : mapper.readValue(parser, mappedTypeRef); } else { obj = getT(buffer, mappedType, mappedTypeRef); } return Maybe.just(obj); } catch (Exception e) { return Maybe.error(e); } } else { return Maybe.empty(); } }); return unmarshalled; }
Example 2
Source File: RequestMappingMessageConversionIntegrationTests.java From spring-analysis-note with MIT License | 4 votes |
@PostMapping("/rxjava2-maybe") public Maybe<Person> transformRxJava2Maybe(@RequestBody Maybe<Person> personFuture) { return personFuture.map(person -> new Person(person.getName().toUpperCase())); }
Example 3
Source File: RequestMappingMessageConversionIntegrationTests.java From java-technology-stack with MIT License | 4 votes |
@PostMapping("/rxjava2-maybe") public Maybe<Person> transformRxJava2Maybe(@RequestBody Maybe<Person> personFuture) { return personFuture.map(person -> new Person(person.getName().toUpperCase())); }