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 |
---|---|
RuntimeException |
getThrowable() |
SuccessObjectType |
getValue() |
boolean |
wasSuccessful() |
public Result(RuntimeException throwable)
throwable
- public Result(SuccessObjectType object)
object
- @Nonnull public RuntimeException getThrowable()
IllegalStateException
- in case this object does not represent a failure@Nonnull 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–2017 The Apache Software Foundation. All rights reserved.