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


Java Try.isSuccess方法代码示例

本文整理汇总了Java中io.vavr.control.Try.isSuccess方法的典型用法代码示例。如果您正苦于以下问题:Java Try.isSuccess方法的具体用法?Java Try.isSuccess怎么用?Java Try.isSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vavr.control.Try的用法示例。


在下文中一共展示了Try.isSuccess方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkColumnsAndBuild

import io.vavr.control.Try; //导入方法依赖的package包/类
private Try<DataTable> checkColumnsAndBuild(String changeType, Supplier<Try<Vector<IDataColumn>>> columns) {
    // Calculate the new column collection then try and build a DataTable from it.
    Try<DataTable> result = columns.get()
            .flatMap(cols -> DataTable.build(this.table.name(), cols));

    return result.isSuccess()
            ? result
            : error("Error " + changeType + " column at specified index.", result.getCause());
}
 
开发者ID:martincooper,项目名称:java-datatable,代码行数:10,代码来源:DataColumnCollection.java

示例2: shouldContainInstanceOf

import io.vavr.control.Try; //导入方法依赖的package包/类
/**
 * Indicates that a value should be present in an empty {@link io.vavr.control.Try}.
 *
 * @param value Try to be checked.
 * @return an error message factory.
 * @throws java.lang.NullPointerException if Try is null.
 */
static TryShouldContainInstanceOf shouldContainInstanceOf(Object value, Class<?> clazz) {
    Try<?> Try = (Try<?>) value;
    if (Try.isSuccess()) {
        return new TryShouldContainInstanceOf(String
          .format("%nExpecting:%n <%s>%nto contain a value that is an instance of:%n <%s>%nbut did contain an instance of:%n <%s>",
            Try.getClass().getSimpleName(), clazz.getName(),
            Try.get().getClass().getName()));
    }
    return new TryShouldContainInstanceOf(String
      .format("%nExpecting:%n <%s>%nto contain a value that is an instance of:%n <%s>%nbut was empty",
        Try.getClass().getSimpleName(), clazz.getName()));
}
 
开发者ID:assertj,项目名称:assertj-vavr,代码行数:20,代码来源:TryShouldContainInstanceOf.java

示例3: columnToValue

import io.vavr.control.Try; //导入方法依赖的package包/类
private Try<Object> columnToValue(Try<IDataColumn> column) {
    return column.isSuccess()
            ? Try.success(column.get().valueAt(this.rowIdx))
            : Try.failure(column.getCause());
}
 
开发者ID:martincooper,项目名称:java-datatable,代码行数:6,代码来源:DataRow.java

示例4: shouldContain

import io.vavr.control.Try; //导入方法依赖的package包/类
/**
 * Indicates that the provided {@link io.vavr.control.Try} does not contain the provided argument.
 *
 * @param Try           the {@link io.vavr.control.Try} which contains a value.
 * @param expectedValue the value we expect to be in the provided {@link io.vavr.control.Try}.
 * @param <VALUE>       the type of the value contained in the {@link io.vavr.control.Try}.
 * @return a error message factory
 */
static <VALUE> TryShouldContain shouldContain(Try<VALUE> Try, VALUE expectedValue) {
    return Try.isSuccess() ?
      new TryShouldContain(EXPECTING_TO_CONTAIN, Try, expectedValue) :
      shouldContain(expectedValue);
}
 
开发者ID:assertj,项目名称:assertj-vavr,代码行数:14,代码来源:TryShouldContain.java

示例5: shouldContainSame

import io.vavr.control.Try; //导入方法依赖的package包/类
/**
 * Indicates that the provided {@link io.vavr.control.Try} does not contain the provided argument (judging by reference
 * equality).
 *
 * @param Try           the {@link io.vavr.control.Try} which contains a value.
 * @param expectedValue the value we expect to be in the provided {@link io.vavr.control.Try}.
 * @param <VALUE>       the type of the value contained in the {@link io.vavr.control.Try}.
 * @return a error message factory
 */
static <VALUE> TryShouldContain shouldContainSame(Try<VALUE> Try, VALUE expectedValue) {
    return Try.isSuccess() ?
      new TryShouldContain(EXPECTING_TO_CONTAIN_SAME, Try, expectedValue) :
      shouldContain(expectedValue);
}
 
开发者ID:assertj,项目名称:assertj-vavr,代码行数:15,代码来源:TryShouldContain.java


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