reactor-core/src/main/java/reactor/core/publisher/Mono.java
public static <I> Mono<I> fromDirect(Publisher<? extends I> source){
		if(source instanceof Mono){
			@SuppressWarnings("unchecked")
			Mono<I> m = (Mono<I>)source;
			return m;
		}
		if(source instanceof Flux){
			@SuppressWarnings("unchecked")
			Flux<I> f = (Flux<I>)source;
			if(source instanceof Fuseable){
				return onAssembly(new MonoSourceFluxFuseable<>(f));
			}
			return onAssembly(new MonoSourceFlux<>(f));
		}
		if(source instanceof Fuseable){
			return onAssembly(new MonoSourceFuseable<>(source));
		}
		return onAssembly(new MonoSource<>(source));
	}
public static <I> Mono<I> fromDirect(Publisher<? extends I> source){
		if(source instanceof Mono){
			@SuppressWarnings("unchecked")
			Mono<I> m = (Mono<I>)source;
			return m;
		}
		if(source instanceof Flux){
			@SuppressWarnings("unchecked")
			Flux<I> f = (Flux<I>)source;
			if(source instanceof Fuseable){
				return onAssembly(new MonoSourceFluxFuseable<>(f));
			}
			return onAssembly(new MonoSourceFlux<>(f));
		}
		if(source instanceof Fuseable){
			return onAssembly(new MonoSourceFuseable<>(source));
		}
		return onAssembly(new MonoSource<>(source));
	}
public static < I > Mono < I > fromDirect ( Publisher < ? extends I > source ) { if ( source instanceof Mono ) { @ SuppressWarnings ( "unchecked" ) Mono < I > m = ( Mono < I > ) source ; return m ; } if ( source instanceof Flux ) { @ SuppressWarnings ( "unchecked" ) Flux < I > f = ( Flux < I > ) source ; if ( source instanceof Fuseable ) { return onAssembly ( new MonoSourceFluxFuseable <> ( f ) ) ; } return onAssembly ( new MonoSourceFlux <> ( f ) ) ; } if ( source instanceof Fuseable ) { return onAssembly ( new MonoSourceFuseable <> ( source ) ) ; } return onAssembly ( new MonoSource <> ( source ) ) ; }
Convert a {@link Publisher} to a {@link Mono} without any cardinality check
(ie this method doesn't check if the source is already a Mono, nor cancels the
source past the first element). Conversion supports {@link Fuseable} sources.
Note this is an advanced interoperability operator that implies you know the
{@link Publisher} you are converting follows the {@link Mono} semantics and only
ever emits one element.

@param source the Mono-compatible {@link Publisher} to wrap
@param <I> type of the value emitted by the publisher
@return a wrapped {@link Mono}
Convert a { @link Publisher } to a { @link Mono } without any cardinality check ( ie this method doesn t check if the source is already a Mono nor cancels the source past the first element ) . Conversion supports { @link Fuseable } sources . Note this is an advanced interoperability operator that implies you know the { @link Publisher } you are converting follows the { @link Mono } semantics and only ever emits one element .