io.trane.future.Future.unsafeCast()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中io.trane.future.Future.unsafeCast()方法的一些代码示例,展示了Future.unsafeCast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Future.unsafeCast()方法的具体详情如下:
包路径:io.trane.future.Future
类名称:Future
方法名:unsafeCast

Future.unsafeCast介绍

[英]Casts the result of this future. Avoid this method since it's unsafe and can produce a future failed with a ClassCastException.
[中]投射出这个未来的结果避免使用此方法,因为它不安全,并且可能产生一个未来失败的ClassCastException。

代码示例

代码示例来源:origin: traneio/future

/**
 * Returns a satisfied future with an empty optional.
 * 
 * @return     the empty optional future.
 * @param <T>  the optional type
 */
public static <T> Future<Optional<T>> emptyOptional() {
 return FutureConstants.EMPTY_OPIONAL.unsafeCast();
}

代码示例来源:origin: traneio/future

/**
 * Returns a future that is never satisfied.
 * 
 * @return     the unsatisfied future.
 * @param <T>  the type of the never satisfied future.
 */
public static <T> Future<T> never() {
 return FutureConstants.NEVER.unsafeCast();
}

代码示例来源:origin: traneio/future

/**
 * Returns a satisfied future with an immutable empty list.
 * 
 * @return     the empty list future.
 * @param <T>  the list type
 */
public static <T> Future<List<T>> emptyList() {
 return FutureConstants.EMPTY_LIST.unsafeCast();
}

代码示例来源:origin: traneio/ndbc

static <R> Exchange<R> fail(final Throwable ex) {
 final Future<Void> result = Future.exception(ex);
 return channel -> result.unsafeCast();
}

代码示例来源:origin: traneio/future

return f.unsafeCast();

相关文章