本文整理汇总了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());
}
示例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()));
}
示例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());
}
示例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);
}
示例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);
}