Package rx.internal.util
Enum Class ExceptionsUtils
- All Implemented Interfaces:
Serializable
,Comparable<ExceptionsUtils>
,Constable
Utility methods for terminal atomics with Throwables.
- Since:
- 1.1.2
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Throwable
The single instance of a Throwable indicating a terminal state. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addThrowable
(AtomicReference<Throwable> field, Throwable error) Atomically sets or combines the error with the contents of the field, wrapping multiple errors into CompositeException if necessary.static boolean
isTerminated
(Throwable error) Returns true if the value is the terminated Throwable instance.static boolean
isTerminated
(AtomicReference<Throwable> field) Checks if the given field holds the terminated Throwable instance.static Throwable
terminate
(AtomicReference<Throwable> field) Atomically swaps in the terminal Throwable and returns the previous contents of the fieldstatic ExceptionsUtils
Returns the enum constant of this class with the specified name.static ExceptionsUtils[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Field Details
-
TERMINATED
The single instance of a Throwable indicating a terminal state.
-
-
Constructor Details
-
ExceptionsUtils
private ExceptionsUtils()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
addThrowable
Atomically sets or combines the error with the contents of the field, wrapping multiple errors into CompositeException if necessary.- Parameters:
field
- the target fielderror
- the error to add- Returns:
- true if successful, false if the target field contains the terminal Throwable.
-
terminate
Atomically swaps in the terminal Throwable and returns the previous contents of the field- Parameters:
field
- the target field- Returns:
- the previous contents of the field before the swap, may be null
-
isTerminated
Checks if the given field holds the terminated Throwable instance.- Parameters:
field
- the target field- Returns:
- true if the given field holds the terminated Throwable instance
-
isTerminated
Returns true if the value is the terminated Throwable instance.- Parameters:
error
- the error to check- Returns:
- true if the value is the terminated Throwable instance
-