public abstract class ErrorDomain
extends java.lang.Object
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.)
super("foo") in the constructor.
public final ErrorCode fields
thus: public final ErrorCode
foo = new ErrorCode("foo")
(Note: not ).
ErrorDomain.ErrorCode.withInternalReason(java.lang.String), ErrorDomain.ErrorCode.withExtendedHelp(java.lang.String), or ErrorDomain.ErrorCode.withSendReport(java.lang.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.
| Modifier and Type | Class and Description |
|---|---|
class |
ErrorDomain.ErrorCode
ErrorCode objects represent an error code within an error domain.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ErrorDomain()
Constructs an ErrorDomain with a default eror domain name.
|
protected |
ErrorDomain(java.lang.String domainName)
Constructs an ErrorDomain with a specified name.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getDomainName()
Returns the name associated with this ErrorDomain..
|
protected ErrorDomain(java.lang.String domainName)
domain element in the XML error format.protected ErrorDomain()
ErrorDomain(String) to set a different domain name.