|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kallasoft.smugmug.api.json.AbstractResponse
public abstract class AbstractResponse
A class that provides the base implementation of a response
from the SmugMug JSON API
methods.
For all of the methods defined in the SmugMug JSON API, all responses share the same fundamental structure of:
String representing the JSON response, and parse out all this
information, optionally creating the AbstractResponse.Error object if an error
occurred, otherwise leaving it null.
To quickly check if the AbstractResponse you are dealing with
represents an error, you can call the isError() method.
All AbstractResponse implementations in this API extend this
base class and provide additional properties and parsing rules depending on
the format of the reply for each particular request.
| Nested Class Summary | |
|---|---|
class |
AbstractResponse.Error
Class used to represent an error from a SmugMug JSON API response. |
| Constructor Summary | |
|---|---|
AbstractResponse(String responseText)
Construct a response that parses it's values out of the given responseText that represents the JSON reply. |
|
| Method Summary | |
|---|---|
AbstractResponse.Error |
getError()
Used to get the AbstractResponse.Error associated with this response if one
occurred, otherwise this will return null. |
String |
getMethod()
Used to get the "method" value from the SmugMug JSON API reply. |
String |
getStat()
Used to get the "stat" value from the SmugMug JSON API reply. |
boolean |
isError()
Used to determine if this response represents an error or not. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractResponse(String responseText)
throws RuntimeJSONException
responseText that represents the JSON reply.
responseText - The text of the JSON reply. If the text is null
this method simply returns.
RuntimeJSONException - if an error occurs while parsing the JSON response text.| Method Detail |
|---|
public String toString()
toString in class Objectpublic boolean isError()
true if an error occurred and this response
contains it's error code and message, otherwise returns
false.public String getStat()
This should either be "ok" or "fail".
public String getMethod()
This is the method that was called, e.g. "smugmug.login.withPassword".
public AbstractResponse.Error getError()
AbstractResponse.Error associated with this response if one
occurred, otherwise this will return null.
AbstractResponse.Error associated with this response if one occurred,
otherwise this will return null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||