|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectNilReason
@Immutable public final class NilReason
Explanation for a missing XML element. The nil reason can be parsed and formatted as
a string using the valueOf(String) and toString() methods respectively. The
string can be either a URI or an enumeration value described below. More specifically,
NilReason can be:
INAPPLICABLE, MISSING, TEMPLATE,
UNKNOWN or WITHHELD enumeration values.OTHER enumeration value, or a new enumeration value formatted as
"other:" concatenated with a brief textual explanation.
NilReason is used in a number of XML elements where it is necessary to permit
one of the above values as an alternative to the primary element.
NilObject,
Serialized Form
| utility/geotk-xml-base (download) | View source code for this class |
| Field Summary | |
|---|---|
static NilReason |
INAPPLICABLE
There is no value. |
static NilReason |
MISSING
The correct value is not readily available to the sender of this data. |
static NilReason |
OTHER
Other brief explanation. |
static NilReason |
TEMPLATE
The value will be available later. |
static NilReason |
UNKNOWN
The correct value is not known to, and not computable by, the sender of this data. |
static NilReason |
WITHHELD
The value is not divulged. |
| Method Summary | ||
|---|---|---|
|
createNilObject(Class<T> type)
Returns an object of the given type which is nil for the reason represented by this enum. |
|
boolean |
equals(Object other)
Compares this NilReason with the specified object for equality. |
|
String |
getExplanation()
If this NilReason is an enumeration of kind OTHER, returns the explanation
text. |
|
URI |
getURI()
If the explanation of this NilReason is referenced by a URI, returns that URI. |
|
int |
hashCode()
Returns a hash code value for this NilReason. |
|
String |
toString()
Returns the GML string representation of this NilReason. |
|
static NilReason |
valueOf(String reason)
Parses the given nil reason. |
|
static NilReason[] |
values()
Returns an array containing every instances of this type that have not yet been garbage collected. |
|
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final NilReason INAPPLICABLE
The string representation is "inapplicable".
public static final NilReason MISSING
The string representation is "missing".
public static final NilReason TEMPLATE
The string representation is "template".
public static final NilReason UNKNOWN
The string representation is "unknown".
public static final NilReason WITHHELD
The string representation is "withheld".
public static final NilReason OTHER
"other", users should invoke the getExplanation()
method instead than comparing against this enumeration.
The string representation is "other:text", where text is a string of two or more
characters with no included spaces.
| Method Detail |
|---|
public static NilReason[] values()
valueOf(String) method, in no particular order.
public static NilReason valueOf(String reason)
throws URISyntaxException
If the given argument is one of the "inapplicable", "missing",
"template", "unknown", "withheld" or "other" strings,
then the corresponding pre-defined constant is returned.
Otherwise if the given argument is "other:" followed by an explanation
text, then a new instance is created and returned for that explanation. Note that
if the given explanation contains any characters that are not
unicode identifier
(for example white spaces), then those characters are omitted.
Otherwise this method attempts to parse the given argument as a URI.
Such URI should refer to a resource which describes the reason for the exception.
reason - The reason why an element is not present.
NilReason object.
URISyntaxException - If the given string is not one of the predefined enumeration
values and can not be parsed as a URI.public String getExplanation()
NilReason is an enumeration of kind OTHER, returns the explanation
text. Otherwise returns null. If non-null, then the explanation is a unicode
identifier without white space.
Note that in the special case where this nil reason is the OTHER
instance itself, then this method returns an empty string.
null if this NilReason
is not an enumeration of kind OTHER.public URI getURI()
NilReason is referenced by a URI, returns that URI.
Otherwise returns null.
null if the explanation of this NilReason
is not referenced by a URI.public String toString()
NilReason. The returned string
is a simple enumeration value (e.g. "inapplicable") if this NilReason
is one of the predefined constants, or a string of the form "other:text", or
a URI.
toString in class ObjectNilReason.public int hashCode()
NilReason.
hashCode in class Objectpublic boolean equals(Object other)
NilReason with the specified object for equality.
equals in class Objectother - The object to compare with this NilReason.public <T> T createNilObject(Class<T> type)
NilObject interface. The NilObject.getNilReason() method will return
this enum, and all other methods (except the ones inherited from the Object class)
will return null or an empty collection as appropriate.
T - The compile-time type of the type argument.type - The object type as an interface.
This is usually a GeoAPI interface.
NilObject of the given type.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||