Package io.vavr.control
Class Try.Failure<T>
- java.lang.Object
-
- io.vavr.control.Try.Failure<T>
-
- Type Parameters:
T- component type of this Failure
public static final class Try.Failure<T> extends java.lang.Object implements Try<T>, java.io.Serializable
A failed Try.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.vavr.control.Try
Try.Failure<T>, Try.Success<T>, Try.WithResources1<T1 extends java.lang.AutoCloseable>, Try.WithResources2<T1 extends java.lang.AutoCloseable,T2 extends java.lang.AutoCloseable>, Try.WithResources3<T1 extends java.lang.AutoCloseable,T2 extends java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable>, Try.WithResources4<T1 extends java.lang.AutoCloseable,T2 extends java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable,T4 extends java.lang.AutoCloseable>, Try.WithResources5<T1 extends java.lang.AutoCloseable,T2 extends java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable,T4 extends java.lang.AutoCloseable,T5 extends java.lang.AutoCloseable>, Try.WithResources6<T1 extends java.lang.AutoCloseable,T2 extends java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable,T4 extends java.lang.AutoCloseable,T5 extends java.lang.AutoCloseable,T6 extends java.lang.AutoCloseable>, Try.WithResources7<T1 extends java.lang.AutoCloseable,T2 extends java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable,T4 extends java.lang.AutoCloseable,T5 extends java.lang.AutoCloseable,T6 extends java.lang.AutoCloseable,T7 extends java.lang.AutoCloseable>, Try.WithResources8<T1 extends java.lang.AutoCloseable,T2 extends java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable,T4 extends java.lang.AutoCloseable,T5 extends java.lang.AutoCloseable,T6 extends java.lang.AutoCloseable,T7 extends java.lang.AutoCloseable,T8 extends java.lang.AutoCloseable>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Throwablecauseprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description privateFailure(java.lang.Throwable cause)Constructs a Failure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Clarifies that values have a proper equals() method implemented.Tget()Gets the result of this Try if this is aSuccessor throws if this is aFailure.java.lang.ThrowablegetCause()Gets the cause if this is a Failure or throws if this is a Success.inthashCode()Clarifies that values have a proper hashCode() method implemented.booleanisEmpty()Checks whether this Try has no result, i.e.booleanisFailure()Checks if this is a Failure.booleanisSuccess()Checks if this is a Success.java.lang.StringstringPrefix()Returns the name of this Value type, which is used by toString().java.lang.StringtoString()Clarifies that values have a proper toString() method implemented.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.vavr.control.Try
andFinally, andFinallyTry, andThen, andThen, andThenTry, andThenTry, collect, failed, filter, filter, filter, filterTry, filterTry, filterTry, flatMap, flatMapTry, fold, getOrElseGet, getOrElseThrow, isAsync, isLazy, isSingleValued, iterator, map, mapFailure, mapTry, onFailure, onFailure, onSuccess, orElse, orElse, orElseRun, peek, recover, recover, recover, recoverWith, recoverWith, recoverWith, toEither, toValidation, toValidation, transform
-
Methods inherited from interface io.vavr.Value
collect, collect, contains, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, out, out, spliterator, stderr, stdout, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
cause
private final java.lang.Throwable cause
-
-
Method Detail
-
get
public T get()
Description copied from interface:TryGets the result of this Try if this is aSuccessor throws if this is aFailure.IMPORTANT! If this is a
Try.Failure, the underlyingcauseof typeThrowableis thrown.The thrown exception is exactly the same as the result of
Try.getCause().
-
getCause
public java.lang.Throwable getCause()
Description copied from interface:TryGets the cause if this is a Failure or throws if this is a Success.
-
isEmpty
public boolean isEmpty()
Description copied from interface:TryChecks whether this Try has no result, i.e. is a Failure.
-
isFailure
public boolean isFailure()
Description copied from interface:TryChecks if this is a Failure.
-
isSuccess
public boolean isSuccess()
Description copied from interface:TryChecks if this is a Success.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:ValueClarifies that values have a proper equals() method implemented.
-
stringPrefix
public java.lang.String stringPrefix()
Description copied from interface:ValueReturns the name of this Value type, which is used by toString().- Specified by:
stringPrefixin interfaceValue<T>- Returns:
- This type name.
-
hashCode
public int hashCode()
Description copied from interface:ValueClarifies that values have a proper hashCode() method implemented.See Object.hashCode().
-
toString
public java.lang.String toString()
Description copied from interface:ValueClarifies that values have a proper toString() method implemented.See Object.toString().
-
-