本文整理汇总了Java中java.util.concurrent.Flow.Processor方法的典型用法代码示例。如果您正苦于以下问题:Java Flow.Processor方法的具体用法?Java Flow.Processor怎么用?Java Flow.Processor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.Flow
的用法示例。
在下文中一共展示了Flow.Processor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toReactiveStreams
import java.util.concurrent.Flow; //导入方法依赖的package包/类
/**
* Converts a Flow Processor into a Reactive Streams Processor.
* @param <T> the input value type
* @param <U> the output value type
* @param flowProcessor the source Flow Processor to convert
* @return the equivalent Reactive Streams Processor
*/
@SuppressWarnings("unchecked")
public static <T, U> org.reactivestreams.Processor<T, U> toReactiveStreams(
Flow.Processor<? super T, ? extends U> flowProcessor
) {
if (flowProcessor == null) {
throw new NullPointerException("flowProcessor");
}
if (flowProcessor instanceof org.reactivestreams.Processor) {
return (org.reactivestreams.Processor<T, U>)flowProcessor;
}
if (flowProcessor instanceof FlowToReactiveProcessor) {
return (org.reactivestreams.Processor<T, U>)(((FlowToReactiveProcessor<T, U>)flowProcessor).reactiveStreams);
}
return new ReactiveToFlowProcessor<T, U>(flowProcessor);
}
示例2: toFlow
import java.util.concurrent.Flow; //导入方法依赖的package包/类
/**
* Converts a Reactive Streams Processor into a Flow Processor.
* @param <T> the input value type
* @param <U> the output value type
* @param reactiveStreamsProcessor the source Reactive Streams Processor to convert
* @return the equivalent Flow Processor
*/
@SuppressWarnings("unchecked")
public static <T, U> Flow.Processor<T, U> toFlow(
org.reactivestreams.Processor<? super T, ? extends U> reactiveStreamsProcessor
) {
if (reactiveStreamsProcessor == null) {
throw new NullPointerException("reactiveStreamsProcessor");
}
if (reactiveStreamsProcessor instanceof Flow.Processor) {
return (Flow.Processor<T, U>)reactiveStreamsProcessor;
}
if (reactiveStreamsProcessor instanceof ReactiveToFlowProcessor) {
return (Flow.Processor<T, U>)(((ReactiveToFlowProcessor<T, U>)reactiveStreamsProcessor).flow);
}
return new FlowToReactiveProcessor<T, U>(reactiveStreamsProcessor);
}
示例3: ReactiveToFlowProcessor
import java.util.concurrent.Flow; //导入方法依赖的package包/类
public ReactiveToFlowProcessor(Flow.Processor<? super T, ? extends U> flow) {
this.flow = flow;
}