java.lang.Object
dev.netcode.util.Result<T>
- Type Parameters:
T- type of object the function should have returned
Instances of this class can be used when a function may encounter an error and
wants to display the error message but you want to manually display it.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Result
Instantiates Result and sets either the value or error.
Only one of both can be set, error is preferred to prevent unexpected behavior.- Parameters:
value- if successful or nullerror- if failed or null- Throws:
IllegalArgumentException- in case both parameters are set to null
-
-
Method Details
-
wasSuccessful
public boolean wasSuccessful()- Returns:
- whether retrieving the result was successful
-
get
- Returns:
- the result
-
getError
- Returns:
- the error
-