Interface IIOMetadataFormat
-
- All Known Implementing Classes:
- IIOMetadataFormatImpl
public interface IIOMetadataFormat
An object describing the structure of metadata documents returned fromIIOMetadata.getAsTree
and passed toIIOMetadata.setFromTree
andmergeTree
. Document structures are described by a set of constraints on the type and number of child elements that may belong to a given parent element type, the names, types, and values of attributes that may belong to an element, and the type and values ofObject
reference that may be stored at a node.N.B: classes that implement this interface should contain a method declared as
public static getInstance()
which returns an instance of the class. Commonly, an implementation will construct only a single instance and cache it for future invocations ofgetInstance
.The structures that may be described by this class are a subset of those expressible using XML document type definitions (DTDs), with the addition of some basic information on the datatypes of attributes and the ability to store an
Object
reference within a node. In the future, XML Schemas could be used to represent these structures, and many others.The differences between
IIOMetadataFormat
-described structures and DTDs are as follows:- Elements may not contain text or mix text with embedded tags.
- The children of an element must conform to one of a few simple patterns, described in the documentation for the
CHILD_*
constants; - The in-memory representation of an elements may contain a reference to an
Object
. There is no provision for representing such objects textually.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
CHILD_POLICY_ALL
A constant returned bygetChildPolicy
to indicate that an element must have a single instance of each of its legal child elements, in order.static int
CHILD_POLICY_CHOICE
A constant returned bygetChildPolicy
to indicate that an element must have zero or one children, selected from among its legal child elements.static int
CHILD_POLICY_EMPTY
A constant returned bygetChildPolicy
to indicate that an element may not have any children.static int
CHILD_POLICY_MAX
The largest validCHILD_POLICY_*
constant, to be used for range checks.static int
CHILD_POLICY_REPEAT
A constant returned bygetChildPolicy
to indicate that an element must have zero or more instances of its unique legal child element.static int
CHILD_POLICY_SEQUENCE
A constant returned bygetChildPolicy
to indicate that an element must have a sequence of instances of any of its legal child elements.static int
CHILD_POLICY_SOME
A constant returned bygetChildPolicy
to indicate that an element must have zero or one instance of each of its legal child elements, in order.static int
DATATYPE_BOOLEAN
A constant returned bygetAttributeDataType
indicating that the value of an attribute is one of the boolean values 'true' or 'false'.static int
DATATYPE_DOUBLE
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a string representation of a double-precision decimal floating-point number.static int
DATATYPE_FLOAT
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a string representation of a decimal floating-point number.static int
DATATYPE_INTEGER
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a string representation of an integer.static int
DATATYPE_STRING
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a general Unicode string.static int
VALUE_ARBITRARY
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set a single, arbitrary value.static int
VALUE_ENUMERATION
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set one of a number of enumerated values.static int
VALUE_LIST
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set to a list or array of values.static int
VALUE_NONE
A constant returned bygetObjectValueType
to indicate the absence of a user object.static int
VALUE_RANGE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set a range of values.static int
VALUE_RANGE_MAX_INCLUSIVE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set to a range of values.static int
VALUE_RANGE_MAX_INCLUSIVE_MASK
A value that may be or'ed withVALUE_RANGE
to obtainVALUE_RANGE_MAX_INCLUSIVE
, and withVALUE_RANGE_MIN_INCLUSIVE
to obtainVALUE_RANGE_MIN_MAX_INCLUSIVE
.static int
VALUE_RANGE_MIN_INCLUSIVE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set to a range of values.static int
VALUE_RANGE_MIN_INCLUSIVE_MASK
A value that may be or'ed withVALUE_RANGE
to obtainVALUE_RANGE_MIN_INCLUSIVE
, and withVALUE_RANGE_MAX_INCLUSIVE
to obtainVALUE_RANGE_MIN_MAX_INCLUSIVE
.static int
VALUE_RANGE_MIN_MAX_INCLUSIVE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set a range of values.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description boolean
canNodeAppear(String elementName, ImageTypeSpecifier imageType)
Returnstrue
if the element (and the subtree below it) is allowed to appear in a metadata document for an image of the given type, defined by anImageTypeSpecifier
.int
getAttributeDataType(String elementName, String attrName)
Returns one of the constants starting withDATATYPE_
, indicating the format and interpretation of the value of the given attribute within the named element.String
getAttributeDefaultValue(String elementName, String attrName)
Returns the default value of the named attribute, if it is not explicitly present within the named element, as aString
, ornull
if no default value is available.String
getAttributeDescription(String elementName, String attrName, Locale locale)
Returns aString
containing a description of the named attribute, ornull
.String[]
getAttributeEnumerations(String elementName, String attrName)
Returns an array ofString
s containing the legal enumerated values for the given attribute within the named element.int
getAttributeListMaxLength(String elementName, String attrName)
Returns the maximum number of list items that may be used to define this attribute.int
getAttributeListMinLength(String elementName, String attrName)
Returns the minimum number of list items that may be used to define this attribute.String
getAttributeMaxValue(String elementName, String attrName)
Returns the maximum legal value for the attribute.String
getAttributeMinValue(String elementName, String attrName)
Returns the minimum legal value for the attribute.String[]
getAttributeNames(String elementName)
Returns an array ofString
s listing the names of the attributes that may be associated with the named element.int
getAttributeValueType(String elementName, String attrName)
Returns one of the constants starting withVALUE_
, indicating whether the values of the given attribute within the named element are arbitrary, constrained to lie within a specified range, constrained to be one of a set of enumerated values, or are a whitespace-separated list of arbitrary values.String[]
getChildNames(String elementName)
Returns an array ofString
s indicating the names of the element which are allowed to be children of the named element, in the order in which they should appear.int
getChildPolicy(String elementName)
Returns one of the constants starting withCHILD_POLICY_
, indicating the legal pattern of children for the named element.String
getElementDescription(String elementName, Locale locale)
Returns aString
containing a description of the named element, ornull
.int
getElementMaxChildren(String elementName)
Returns the maximum number of children of the named element with child policyCHILD_POLICY_REPEAT
.int
getElementMinChildren(String elementName)
Returns the minimum number of children of the named element with child policyCHILD_POLICY_REPEAT
.int
getObjectArrayMaxLength(String elementName)
Returns the maximum number of array elements that may be used to define theObject
reference within the named element.int
getObjectArrayMinLength(String elementName)
Returns the minimum number of array elements that may be used to define theObject
reference within the named element.Class<?>
getObjectClass(String elementName)
Returns theClass
type of theObject
reference stored within the element.Object
getObjectDefaultValue(String elementName)
Returns anObject
s containing the default value for theObject
reference within the named element.Object[]
getObjectEnumerations(String elementName)
Returns an array ofObject
s containing the legal enumerated values for theObject
reference within the named element.Comparable<?>
getObjectMaxValue(String elementName)
Returns the maximum legal value for theObject
reference within the named element.Comparable<?>
getObjectMinValue(String elementName)
Returns the minimum legal value for theObject
reference within the named element.int
getObjectValueType(String elementName)
Returns one of the enumerated values starting withVALUE_
, indicating the type of values (enumeration, range, or array) that are allowed for theObject
reference.String
getRootName()
Returns the name of the root element of the format.boolean
isAttributeRequired(String elementName, String attrName)
Returnstrue
if the named attribute must be present within the named element.
-
-
-
Field Detail
CHILD_POLICY_EMPTY
static final int CHILD_POLICY_EMPTY
A constant returned bygetChildPolicy
to indicate that an element may not have any children. In other words, it is required to be a leaf node.- See Also:
- Constant Field Values
CHILD_POLICY_ALL
static final int CHILD_POLICY_ALL
A constant returned bygetChildPolicy
to indicate that an element must have a single instance of each of its legal child elements, in order. In DTD terms, the contents of the element are defined by a sequencea,b,c,d,...
.- See Also:
- Constant Field Values
CHILD_POLICY_SOME
static final int CHILD_POLICY_SOME
A constant returned bygetChildPolicy
to indicate that an element must have zero or one instance of each of its legal child elements, in order. In DTD terms, the contents of the element are defined by a sequencea?,b?,c?,d?,...
.- See Also:
- Constant Field Values
CHILD_POLICY_CHOICE
static final int CHILD_POLICY_CHOICE
A constant returned bygetChildPolicy
to indicate that an element must have zero or one children, selected from among its legal child elements. In DTD terms, the contents of the element are defined by a selectiona|b|c|d|...
.- See Also:
- Constant Field Values
CHILD_POLICY_SEQUENCE
static final int CHILD_POLICY_SEQUENCE
A constant returned bygetChildPolicy
to indicate that an element must have a sequence of instances of any of its legal child elements. In DTD terms, the contents of the element are defined by a sequence(a|b|c|d|...)*
.- See Also:
- Constant Field Values
CHILD_POLICY_REPEAT
static final int CHILD_POLICY_REPEAT
A constant returned bygetChildPolicy
to indicate that an element must have zero or more instances of its unique legal child element. In DTD terms, the contents of the element are defined by a starred expressiona*
.- See Also:
- Constant Field Values
CHILD_POLICY_MAX
static final int CHILD_POLICY_MAX
The largest validCHILD_POLICY_*
constant, to be used for range checks.- See Also:
- Constant Field Values
VALUE_NONE
static final int VALUE_NONE
A constant returned bygetObjectValueType
to indicate the absence of a user object.- See Also:
- Constant Field Values
VALUE_ARBITRARY
static final int VALUE_ARBITRARY
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set a single, arbitrary value.- See Also:
- Constant Field Values
VALUE_RANGE
static final int VALUE_RANGE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set a range of values. Both the minimum and maximum values of the range are exclusive. It is recommended that ranges of integers be inclusive on both ends, and that exclusive ranges be used only for floating-point data.
VALUE_RANGE_MIN_INCLUSIVE_MASK
static final int VALUE_RANGE_MIN_INCLUSIVE_MASK
A value that may be or'ed withVALUE_RANGE
to obtainVALUE_RANGE_MIN_INCLUSIVE
, and withVALUE_RANGE_MAX_INCLUSIVE
to obtainVALUE_RANGE_MIN_MAX_INCLUSIVE
.Similarly, the value may be and'ed with the value of
getAttributeValueType
orgetObjectValueType
to determine if the minimum value of the range is inclusive.- See Also:
- Constant Field Values
VALUE_RANGE_MAX_INCLUSIVE_MASK
static final int VALUE_RANGE_MAX_INCLUSIVE_MASK
A value that may be or'ed withVALUE_RANGE
to obtainVALUE_RANGE_MAX_INCLUSIVE
, and withVALUE_RANGE_MIN_INCLUSIVE
to obtainVALUE_RANGE_MIN_MAX_INCLUSIVE
.Similarly, the value may be and'ed with the value of
getAttributeValueType
orgetObjectValueType
to determine if the maximum value of the range is inclusive.- See Also:
- Constant Field Values
VALUE_RANGE_MIN_INCLUSIVE
static final int VALUE_RANGE_MIN_INCLUSIVE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set to a range of values. The minimum (but not the maximum) value of the range is inclusive.- See Also:
- Constant Field Values
VALUE_RANGE_MAX_INCLUSIVE
static final int VALUE_RANGE_MAX_INCLUSIVE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set to a range of values. The maximum (but not the minimum) value of the range is inclusive.- See Also:
- Constant Field Values
VALUE_RANGE_MIN_MAX_INCLUSIVE
static final int VALUE_RANGE_MIN_MAX_INCLUSIVE
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set a range of values. Both the minimum and maximum values of the range are inclusive. It is recommended that ranges of integers be inclusive on both ends, and that exclusive ranges be used only for floating-point data.- See Also:
- Constant Field Values
VALUE_ENUMERATION
static final int VALUE_ENUMERATION
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set one of a number of enumerated values. In the case of attributes, these values areString
s; for objects, they areObject
s implementing a given class or interface.Attribute values of type
DATATYPE_BOOLEAN
should be marked as enumerations.- See Also:
- Constant Field Values
VALUE_LIST
static final int VALUE_LIST
A constant returned bygetAttributeValueType
andgetObjectValueType
to indicate that the attribute or user object may be set to a list or array of values. In the case of attributes, the list will consist of whitespace-separated values within aString
; for objects, an array will be used.- See Also:
- Constant Field Values
DATATYPE_STRING
static final int DATATYPE_STRING
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a general Unicode string.- See Also:
- Constant Field Values
DATATYPE_BOOLEAN
static final int DATATYPE_BOOLEAN
A constant returned bygetAttributeDataType
indicating that the value of an attribute is one of the boolean values 'true' or 'false'. Attribute values of type DATATYPE_BOOLEAN should be marked as enumerations, and the permitted values should be the string literal values "TRUE" or "FALSE", although a plugin may also recognise lower or mixed case equivalents.- See Also:
- Constant Field Values
DATATYPE_INTEGER
static final int DATATYPE_INTEGER
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a string representation of an integer.- See Also:
- Constant Field Values
DATATYPE_FLOAT
static final int DATATYPE_FLOAT
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a string representation of a decimal floating-point number.- See Also:
- Constant Field Values
DATATYPE_DOUBLE
static final int DATATYPE_DOUBLE
A constant returned bygetAttributeDataType
indicating that the value of an attribute is a string representation of a double-precision decimal floating-point number.- See Also:
- Constant Field Values
-
Method Detail
getRootName
String getRootName()
Returns the name of the root element of the format.- Returns:
-
a
String
.
canNodeAppear
boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType)
Returnstrue
if the element (and the subtree below it) is allowed to appear in a metadata document for an image of the given type, defined by anImageTypeSpecifier
. For example, a metadata document format might contain an element that describes the primary colors of the image, which would not be allowed when writing a grayscale image.- Parameters:
-
elementName
- the name of the element being queried. -
imageType
- anImageTypeSpecifier
indicating the type of the image that will be associated with the metadata. - Returns:
-
true
if the node is meaningful for images of the given type.
getElementMinChildren
int getElementMinChildren(String elementName)
Returns the minimum number of children of the named element with child policyCHILD_POLICY_REPEAT
. For example, an element representing color primary information might be required to have at least 3 children, one for each primary.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
an
int
. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element does not have a child policy ofCHILD_POLICY_REPEAT
.
getElementMaxChildren
int getElementMaxChildren(String elementName)
Returns the maximum number of children of the named element with child policyCHILD_POLICY_REPEAT
. For example, an element representing an entry in an 8-bit color palette might be allowed to repeat up to 256 times. A value ofInteger.MAX_VALUE
may be used to specify that there is no upper bound.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
an
int
. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element does not have a child policy ofCHILD_POLICY_REPEAT
.
getElementDescription
String getElementDescription(String elementName, Locale locale)
Returns aString
containing a description of the named element, ornull
. The description will be localized for the suppliedLocale
if possible.If
locale
isnull
, the current defaultLocale
returned byLocale.getLocale
will be used.- Parameters:
-
elementName
- the name of the element. -
locale
- theLocale
for which localization will be attempted. - Returns:
- the element description.
- Throws:
-
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.
getChildPolicy
int getChildPolicy(String elementName)
Returns one of the constants starting withCHILD_POLICY_
, indicating the legal pattern of children for the named element.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
one of the
CHILD_POLICY_*
constants. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format.
getChildNames
String[] getChildNames(String elementName)
Returns an array ofString
s indicating the names of the element which are allowed to be children of the named element, in the order in which they should appear. If the element cannot have children,null
is returned.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
an array of
String
s, or null. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format.
getAttributeNames
String[] getAttributeNames(String elementName)
Returns an array ofString
s listing the names of the attributes that may be associated with the named element.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
an array of
String
s. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format.
getAttributeValueType
int getAttributeValueType(String elementName, String attrName)
Returns one of the constants starting withVALUE_
, indicating whether the values of the given attribute within the named element are arbitrary, constrained to lie within a specified range, constrained to be one of a set of enumerated values, or are a whitespace-separated list of arbitrary values.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
-
one of the
VALUE_*
constants. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element.
getAttributeDataType
int getAttributeDataType(String elementName, String attrName)
Returns one of the constants starting withDATATYPE_
, indicating the format and interpretation of the value of the given attribute within the named element. IfgetAttributeValueType
returnsVALUE_LIST
, then the legal value is a whitespace-spearated list of values of the returned datatype.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
-
one of the
DATATYPE_*
constants. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element.
isAttributeRequired
boolean isAttributeRequired(String elementName, String attrName)
Returnstrue
if the named attribute must be present within the named element.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
-
true
if the attribute must be present. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element.
getAttributeDefaultValue
String getAttributeDefaultValue(String elementName, String attrName)
Returns the default value of the named attribute, if it is not explicitly present within the named element, as aString
, ornull
if no default value is available.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
-
a
String
containing the default value, ornull
. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element.
getAttributeEnumerations
String[] getAttributeEnumerations(String elementName, String attrName)
Returns an array ofString
s containing the legal enumerated values for the given attribute within the named element. This method should only be called ifgetAttributeValueType
returnsVALUE_ENUMERATION
.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
-
an array of
String
s. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element. -
IllegalArgumentException
- if the given attribute is not defined as an enumeration.
getAttributeMinValue
String getAttributeMinValue(String elementName, String attrName)
Returns the minimum legal value for the attribute. Whether this value is inclusive or exclusive may be determined by the value ofgetAttributeValueType
. The value is returned as aString
; its interpretation is dependent on the value ofgetAttributeDataType
. This method should only be called ifgetAttributeValueType
returnsVALUE_RANGE_*
.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
-
a
String
containing the smallest legal value for the attribute. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element. -
IllegalArgumentException
- if the given attribute is not defined as a range.
getAttributeMaxValue
String getAttributeMaxValue(String elementName, String attrName)
Returns the maximum legal value for the attribute. Whether this value is inclusive or exclusive may be determined by the value ofgetAttributeValueType
. The value is returned as aString
; its interpretation is dependent on the value ofgetAttributeDataType
. This method should only be called ifgetAttributeValueType
returnsVALUE_RANGE_*
.- Parameters:
-
elementName
- the name of the element being queried, as aString
. -
attrName
- the name of the attribute being queried. - Returns:
-
a
String
containing the largest legal value for the attribute. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element. -
IllegalArgumentException
- if the given attribute is not defined as a range.
getAttributeListMinLength
int getAttributeListMinLength(String elementName, String attrName)
Returns the minimum number of list items that may be used to define this attribute. The attribute itself is defined as aString
containing multiple whitespace-separated items. This method should only be called ifgetAttributeValueType
returnsVALUE_LIST
.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
- the smallest legal number of list items for the attribute.
- Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element. -
IllegalArgumentException
- if the given attribute is not defined as a list.
getAttributeListMaxLength
int getAttributeListMaxLength(String elementName, String attrName)
Returns the maximum number of list items that may be used to define this attribute. A value ofInteger.MAX_VALUE
may be used to specify that there is no upper bound. The attribute itself is defined as aString
containing multiple whitespace-separated items. This method should only be called ifgetAttributeValueType
returnsVALUE_LIST
.- Parameters:
-
elementName
- the name of the element being queried. -
attrName
- the name of the attribute being queried. - Returns:
- the largest legal number of list items for the attribute.
- Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element. -
IllegalArgumentException
- if the given attribute is not defined as a list.
getAttributeDescription
String getAttributeDescription(String elementName, String attrName, Locale locale)
Returns aString
containing a description of the named attribute, ornull
. The description will be localized for the suppliedLocale
if possible.If
locale
isnull
, the current defaultLocale
returned byLocale.getLocale
will be used.- Parameters:
-
elementName
- the name of the element. -
attrName
- the name of the attribute. -
locale
- theLocale
for which localization will be attempted. - Returns:
- the attribute description.
- Throws:
-
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format. -
IllegalArgumentException
- ifattrName
isnull
or is not a legal attribute name for this element.
getObjectValueType
int getObjectValueType(String elementName)
Returns one of the enumerated values starting withVALUE_
, indicating the type of values (enumeration, range, or array) that are allowed for theObject
reference. If no object value can be stored within the given element, the result of this method will beVALUE_NONE
.Object
references whose legal values are defined as a range must implement theComparable
interface.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
one of the
VALUE_*
constants. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. - See Also:
-
Comparable
getObjectClass
Class<?> getObjectClass(String elementName)
Returns theClass
type of theObject
reference stored within the element. If this element may not contain anObject
reference, anIllegalArgumentException
will be thrown. If the class type is an array, this field indicates the underlying class type (e.g, for an array ofint
s, this method would returnint.class
).Object
references whose legal values are defined as a range must implement theComparable
interface.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
a
Class
object. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element cannot contain an object value (i.e., ifgetObjectValueType(elementName) == VALUE_NONE
).
getObjectDefaultValue
Object getObjectDefaultValue(String elementName)
Returns anObject
s containing the default value for theObject
reference within the named element.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
an
Object
. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element cannot contain an object value (i.e., ifgetObjectValueType(elementName) == VALUE_NONE
).
getObjectEnumerations
Object[] getObjectEnumerations(String elementName)
Returns an array ofObject
s containing the legal enumerated values for theObject
reference within the named element. This method should only be called ifgetObjectValueType
returnsVALUE_ENUMERATION
.The
Object
associated with a node that accepts enumerated values must be equal to one of the values returned by this method, as defined by the==
operator (as opposed to theObject.equals
method).- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
an array of
Object
s. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element cannot contain an object value (i.e., ifgetObjectValueType(elementName) == VALUE_NONE
). -
IllegalArgumentException
- if theObject
is not defined as an enumeration.
getObjectMinValue
Comparable<?> getObjectMinValue(String elementName)
Returns the minimum legal value for theObject
reference within the named element. Whether this value is inclusive or exclusive may be determined by the value ofgetObjectValueType
. This method should only be called ifgetObjectValueType
returns one of the constants starting withVALUE_RANGE
.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
- the smallest legal value for the attribute.
- Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element cannot contain an object value (i.e., ifgetObjectValueType(elementName) == VALUE_NONE
). -
IllegalArgumentException
- if theObject
is not defined as a range.
getObjectMaxValue
Comparable<?> getObjectMaxValue(String elementName)
Returns the maximum legal value for theObject
reference within the named element. Whether this value is inclusive or exclusive may be determined by the value ofgetObjectValueType
. This method should only be called ifgetObjectValueType
returns one of the constants starting withVALUE_RANGE
.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
- the smallest legal value for the attribute.
- Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element cannot contain an object value (i.e., ifgetObjectValueType(elementName) == VALUE_NONE
). -
IllegalArgumentException
- if theObject
is not defined as a range.
getObjectArrayMinLength
int getObjectArrayMinLength(String elementName)
Returns the minimum number of array elements that may be used to define theObject
reference within the named element. This method should only be called ifgetObjectValueType
returnsVALUE_LIST
.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
the smallest valid array length for the
Object
reference. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element cannot contain an object value (i.e., ifgetObjectValueType(elementName) == VALUE_NONE
). -
IllegalArgumentException
- if theObject
is not an array.
getObjectArrayMaxLength
int getObjectArrayMaxLength(String elementName)
Returns the maximum number of array elements that may be used to define theObject
reference within the named element. A value ofInteger.MAX_VALUE
may be used to specify that there is no upper bound. This method should only be called ifgetObjectValueType
returnsVALUE_LIST
.- Parameters:
-
elementName
- the name of the element being queried. - Returns:
-
the largest valid array length for the
Object
reference. - Throws:
-
IllegalArgumentException
- ifelementName
isnull
or is not a legal element name for this format. -
IllegalArgumentException
- if the named element cannot contain an object value (i.e., ifgetObjectValueType(elementName) == VALUE_NONE
). -
IllegalArgumentException
- if theObject
is not an array.
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.