public class Result<SuccessObjectType> extends Object
RuntimeException
s in case of an error. It is used because the
different instantiation methods for models don't all allow exceptions to be
thrown. Also throwing and catching exceptions would decrease the runtime performance.
Therefore this class is used to throw the exception only if necessary.Constructor and Description |
---|
Result(RuntimeException throwable)
instantiate with one throwable (i.e.
|
Result(SuccessObjectType object)
instantate with a model (i.e.
|
Modifier and Type | Method and Description |
---|---|
@NotNull RuntimeException |
getThrowable() |
SuccessObjectType |
getValue() |
boolean |
wasSuccessful() |
public Result(RuntimeException throwable)
throwable
- public Result(SuccessObjectType object)
object
- @NotNull public @NotNull RuntimeException getThrowable()
IllegalStateException
- in case this object does not represent a failure@NotNull public SuccessObjectType getValue()
IllegalStateException
- in case this object does not represent a successpublic boolean wasSuccessful()
true
in case this object represents a success, otherwise
false
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.