public abstract class

ErrorDomain

extends Object
java.lang.Object
   ↳ com.google.gdata.util.ErrorDomain
Known Direct Subclasses

Class Overview

This is the parent class of all error domain classes. Error domain classes package up a group of related error codes (and associated information) into an error domain with a unique name, by default the fully qualified name of the class. Create an error domain as follows:

  • Subclass ErrorDomain.
  • In the subclass, provide an empty private constructor and a public static final variable named ERR with the same type as the subclass; initialize it to an instance of the subclass. (This is eager singleton initialization.)
  • Alternatively, if you want to specify a non-default domain name, use super("foo") in the constructor.
  • Declare public final ErrorCode fields thus: public final ErrorCode foo = new ErrorCode("foo") (Note: not {@static }).
  • Append to each field declaration optional calls to withInternalReason(String), withExtendedHelp(String), or withSendReport(String).

Here's a complete example:

 public class FooErrorDomain extends ErrorDomain {
   private FooErrorDomain() {
     super("Foo");
   }
 
   public static final FooErrorDomain ERR = new FooErrorDomain();
 
   public final ErrorCode bar = new ErrorCode("brokenBar")
       .withInternalReason("Bar is not working yet");
 
   public final ErrorCode unsupported = new ErrorCode("unsupported")
       .withInternalReason("Requested key is not supported");
 
   public final ErrorCode invalid = new ErrorCode("invalidValue")
       .withInternalReason("Invalid value for attribute")
       .withExtendedHelp("http://www.google.com/foo/validAttributes.html");
 
 }
 

Note that all with methods return a mutated copy.

Summary

Nested Classes
class ErrorDomain.ErrorCode ErrorCode objects represent an error code within an error domain. 
Fields
private final String domainName
Protected Constructors
ErrorDomain(String domainName)
Constructs an ErrorDomain with a specified name.
ErrorDomain()
Constructs an ErrorDomain with a default eror domain name.
Public Methods
String getDomainName()
Returns the name associated with this ErrorDomain..
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private final String domainName

Protected Constructors

protected ErrorDomain (String domainName)

Constructs an ErrorDomain with a specified name. This can be called only from the constructor of a subclass. The value will appear as the content of the domain element in the XML error format.

Parameters
domainName

protected ErrorDomain ()

Constructs an ErrorDomain with a default eror domain name. Use ErrorDomain(String) to set a different domain name.

Public Methods

public String getDomainName ()

Returns the name associated with this ErrorDomain..