Package uk.blankaspect.common.jsonxml
Enum Class ElementKind
- All Implemented Interfaces:
Serializable
,Comparable<ElementKind>
,Constable
This is an enumeration of the kinds of element that may appear in a tree of JSON-XML.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class implements an unchecked exception that may be thrown if an XML element is encountered where a JSON-XML element is expected.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Set
<ElementKind> The kinds of element that correspond to compound JSON values.static final Set
<ElementKind> The kinds of element that correspond to simple JSON values. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Returnstrue
if the specified XML element matches any kind of JSON-XML element.createElement
(IElementFacade elementFacade) Creates and returns a new instance of a JSON-XML element of this kind using the specified facade.boolean
Returnstrue
if this kind of JSON-XML element corresponds to a compound JSON value (array or object).static boolean
isCompound
(Element element) Returnstrue
if the specified XML element matches a kind of JSON-XML element that corresponds to a compound JSON value (array or object).boolean
isSimple()
Returnstrue
if this kind of JSON-XML element corresponds to a simple JSON value (null, Boolean, number or string).static boolean
Returnstrue
if the specified XML element matches a kind of JSON-XML element that corresponds to a simple JSON value (null, Boolean, number or string).key()
Returns the key of this kind of JSON-XML element.boolean
Returnstrue
if the specified XML element matches this kind of JSON-XML element.static boolean
matches
(Element element, Iterable<ElementKind> elementKinds) Returnstrue
if the specified XML element matches one of the specified kinds of JSON-XML element.static boolean
matches
(Element element, ElementKind... elementKinds) Returnstrue
if the specified XML element matches one of the specified kinds of JSON-XML element.static ElementKind
Returns the kind of JSON-XML element of the specified XML element.static ElementKind
Returns the kind of JSON-XML element of the specified XML element.static ElementKind
Returns the enum constant of this class with the specified name.static ElementKind[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NULL
Corresponds to a JSON null value. -
BOOLEAN
Corresponds to a JSON Boolean value. -
NUMBER
Corresponds to a JSON number. -
STRING
Corresponds to a JSON string. -
ARRAY
Corresponds to a JSON array. -
OBJECT
Corresponds to a JSON object.
-
-
Field Details
-
SIMPLE_KINDS
The kinds of element that correspond to simple JSON values. -
COMPOUND_KINDS
The kinds of element that correspond to compound JSON values.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
of
Returns the kind of JSON-XML element of the specified XML element.- Parameters:
element
- the XML element of interest.- Returns:
- the kind of JSON-XML element of
element
, ornull
if the element is not a JSON-XML element.
-
ofThrow
Returns the kind of JSON-XML element of the specified XML element. An exception is thrown if the element is not a JSON-XML element.- Parameters:
element
- the XML element of interest.- Returns:
- the kind of JSON-XML element of
element
. - Throws:
ElementKind.UnexpectedKindException
- ifelement
is not a JSON-XML element.
-
matches
Returnstrue
if the specified XML element matches one of the specified kinds of JSON-XML element.- Parameters:
element
- the XML element of interest.elementKinds
- the kinds of JSON-XML element against whichelement
will be tested.- Returns:
true
ifelement
matches one ofelementKinds
;false
otherwise.
-
matches
Returnstrue
if the specified XML element matches one of the specified kinds of JSON-XML element.- Parameters:
element
- the XML element of interest.elementKinds
- the kinds of JSON-XML element against whichelement
will be tested.- Returns:
true
ifelement
matches one ofelementKinds
;false
otherwise.
-
anyMatch
Returnstrue
if the specified XML element matches any kind of JSON-XML element.- Parameters:
element
- the XML element of interest.- Returns:
true
ifelement
matches any kind of JSON-XML element;false
otherwise.
-
isSimple
Returnstrue
if the specified XML element matches a kind of JSON-XML element that corresponds to a simple JSON value (null, Boolean, number or string).- Parameters:
element
- the XML element of interest.- Returns:
true
ifelement
matches a kind of JSON-XML element that corresponds to a simple JSON value (null, Boolean, number or string);false
otherwise.
-
isCompound
Returnstrue
if the specified XML element matches a kind of JSON-XML element that corresponds to a compound JSON value (array or object).- Parameters:
element
- the XML element of interest.- Returns:
true
ifelement
matches a kind of JSON-XML element that corresponds to a compound JSON value (array or object);false
otherwise.
-
key
Returns the key of this kind of JSON-XML element.- Returns:
- the key of this kind of JSON-XML element.
-
isSimple
public boolean isSimple()Returnstrue
if this kind of JSON-XML element corresponds to a simple JSON value (null, Boolean, number or string).- Returns:
true
if this kind of JSON-XML element corresponds to a simple JSON value (null, Boolean, number or string);false
otherwise.
-
isCompound
public boolean isCompound()Returnstrue
if this kind of JSON-XML element corresponds to a compound JSON value (array or object).- Returns:
true
if this kind of JSON-XML element corresponds to a compound JSON value (array or object);false
otherwise.
-
matches
Returnstrue
if the specified XML element matches this kind of JSON-XML element.- Parameters:
element
- the XML element of interest.- Returns:
true
ifelement
matches this kind of JSON-XML element;false
otherwise.
-
createElement
Creates and returns a new instance of a JSON-XML element of this kind using the specified facade.- Parameters:
elementFacade
- the facade through which the JSON-XML element will be created.- Returns:
- a new instance of a JSON-XML element whose name is derived from the key of this kind of element.
-