I have Flux or Mono which is being populated with different custom objects which i am not aware of.
I want to retrieve Object class name without blocking the Flux or Mono.
You can do this by mapping Mono
like such:
Mono<String> mono = Mono.just(...some object goes here)
.map(object -> object.getClass().getSimpleName());
It should be relatively obvious what is going on here -- we are mapping the object to the object's class name (all while staying inside mono
)
Flux<String> mono = Flux.fromIterable(...some list of objects)
.flatMap(object -> object.getClass().getSimpleName);
(Note: I'm not super sure about Flux
... writing this code without an IDE. But it should be very close.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.