com.google.api.client.googleapis.json
Class GoogleJsonError

java.lang.Object
  extended by java.util.AbstractMap<String,Object>
      extended by com.google.api.client.util.GenericData
          extended by com.google.api.client.json.GenericJson
              extended by com.google.api.client.googleapis.json.GoogleJsonError
All Implemented Interfaces:
Cloneable, Map<String,Object>

public class GoogleJsonError
extends GenericJson

Data class representing the Google JSON error response content, as documented for example in Error responses.

Since:
1.4
Author:
Yaniv Inbar

Nested Class Summary
static class GoogleJsonError.ErrorInfo
          Detailed error information.
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 int code
          Deprecated. (scheduled to be made private in 1.9) Use getCode() or setCode(int)
 List<GoogleJsonError.ErrorInfo> errors
          Deprecated. (scheduled to be made private in 1.9) Use getErrors() or setErrors(java.util.List)
 String message
          Deprecated. (scheduled to be made private in 1.9) Use getMessage() or setMessage(java.lang.String)
 
Constructor Summary
GoogleJsonError()
           
 
Method Summary
 int getCode()
          Returns the HTTP status code of this response or null for none.
 List<GoogleJsonError.ErrorInfo> getErrors()
          Returns the list of detailed errors or null for none.
 String getMessage()
          Returns the human-readable explanation of the error or null for none.
static GoogleJsonError parse(JsonFactory jsonFactory, HttpResponse response)
          Parses the given error HTTP response using the given JSON factory.
 void setCode(int code)
          Sets the HTTP status code of this response or null for none.
 void setErrors(List<GoogleJsonError.ErrorInfo> errors)
          Sets the list of detailed errors or null for none.
 void setMessage(String message)
          Sets the human-readable explanation of the error or null for none.
 
Methods inherited from class com.google.api.client.json.GenericJson
clone, getFactory, setFactory, toPrettyString, toString
 
Methods inherited from class com.google.api.client.util.GenericData
entrySet, get, getUnknownKeys, put, putAll, remove, set, setUnknownKeys
 
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

errors

@Deprecated
public List<GoogleJsonError.ErrorInfo> errors
Deprecated. (scheduled to be made private in 1.9) Use getErrors() or setErrors(java.util.List)
List of detailed errors or null for none.


code

@Deprecated
public int code
Deprecated. (scheduled to be made private in 1.9) Use getCode() or setCode(int)
HTTP status code of this response or null for none.


message

@Deprecated
public String message
Deprecated. (scheduled to be made private in 1.9) Use getMessage() or setMessage(java.lang.String)
Human-readable explanation of the error or null for none.

Constructor Detail

GoogleJsonError

public GoogleJsonError()
Method Detail

parse

public static GoogleJsonError parse(JsonFactory jsonFactory,
                                    HttpResponse response)
                             throws IOException
Parses the given error HTTP response using the given JSON factory.

Parameters:
jsonFactory - JSON factory
response - HTTP response
Returns:
new instance of the Google JSON error information
Throws:
IllegalArgumentException - if content type is not Json.CONTENT_TYPE or if expected "data" or "error" key is not found
IOException

getErrors

public final List<GoogleJsonError.ErrorInfo> getErrors()
Returns the list of detailed errors or null for none.

Since:
1.8

setErrors

public final void setErrors(List<GoogleJsonError.ErrorInfo> errors)
Sets the list of detailed errors or null for none.

Since:
1.8

getCode

public final int getCode()
Returns the HTTP status code of this response or null for none.

Since:
1.8

setCode

public final void setCode(int code)
Sets the HTTP status code of this response or null for none.

Since:
1.8

getMessage

public final String getMessage()
Returns the human-readable explanation of the error or null for none.

Since:
1.8

setMessage

public final void setMessage(String message)
Sets the human-readable explanation of the error or null for none.

Since:
1.8


Copyright © 2010-2012 Google. All Rights Reserved.