|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.washington.cs.sounddetector.server.api.MethodResult<T>
public abstract class MethodResult<T extends Method>
A MethodResult represents the response from executing a Method
. A MethodResult will
provide a method call to obtain the results of the Method. This method will either return the
results of the Method or throw a subclass of SoundDetectorAPIException to indicate failure.
More details:
There are two general states a MethodResult can be in: one for if the Method was successful and one for if it was not successful.
If the execution of a Method was successful, then the MethodResult will contain the expected data from running the Method.
On the other hand, if the execution of a Method was unsuccessful, then the MethodResult will contain the reason it was unsuccessful in the form of an SoundDetectorAPIException. This exception will be triggered upon attempted retrieval of the results.
Requirements for subclasses of MethodResult:
Nested Class Summary | |
---|---|
static class |
MethodResult.FailureReason
FailureReason enumerates all the possible reasons the execution of a method could fail. |
Constructor Summary | |
---|---|
protected |
MethodResult(boolean successful,
MethodResult.FailureReason reason)
Constructs a new MethodResult. |
Method Summary | |
---|---|
MethodResult.FailureReason |
getReason()
|
boolean |
isSuccessful()
|
void |
setReason(MethodResult.FailureReason reason)
|
void |
setSuccessful(boolean successful)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected MethodResult(boolean successful, MethodResult.FailureReason reason)
successful
- whether the method was successful or notreason
- If successful == true, then this should be null. If successful == false, then this
must not be null.Method Detail |
---|
public boolean isSuccessful()
public void setSuccessful(boolean successful)
successful
- the successful to setpublic void setReason(MethodResult.FailureReason reason)
reason
- the reason to setpublic MethodResult.FailureReason getReason()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |