当前位置: 首页>>代码示例>>Java>>正文


Java Flow.Processor方法代码示例

本文整理汇总了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);
}
 
开发者ID:OlegDokuka,项目名称:reactive-streams-tck_playground,代码行数:23,代码来源:ReactiveStreamsFlowBridge.java

示例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);
}
 
开发者ID:OlegDokuka,项目名称:reactive-streams-tck_playground,代码行数:23,代码来源:ReactiveStreamsFlowBridge.java

示例3: ReactiveToFlowProcessor

import java.util.concurrent.Flow; //导入方法依赖的package包/类
public ReactiveToFlowProcessor(Flow.Processor<? super T, ? extends U> flow) {
    this.flow = flow;
}
 
开发者ID:OlegDokuka,项目名称:reactive-streams-tck_playground,代码行数:4,代码来源:ReactiveStreamsFlowBridge.java


注:本文中的java.util.concurrent.Flow.Processor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。