Class IIOMetadataFormatImpl
- All Implemented Interfaces:
IIOMetadataFormat
IIOMetadataFormat
interface. In addition, a static
instance representing the standard, plug-in neutral
javax_imageio_1.0
format is provided by the
getStandardFormatInstance
method.
In order to supply localized descriptions of elements and
attributes, a ResourceBundle
with a base name of
this.getClass().getName() + "Resources"
should be
supplied via the usual mechanism used by
ResourceBundle.getBundle
. Briefly, the subclasser
supplies one or more additional classes according to a naming
convention (by default, the fully-qualified name of the subclass
extending IIMetadataFormatImpl
, plus the string
"Resources", plus the country, language, and variant codes
separated by underscores). At run time, calls to
getElementDescription
or
getAttributeDescription
will attempt to load such
classes dynamically according to the supplied locale, and will use
either the element name, or the element name followed by a '/'
character followed by the attribute name as a key. This key will
be supplied to the ResourceBundle
's
getString
method, and the resulting localized
description of the node or attribute is returned.
The subclass may supply a different base name for the resource
bundles using the setResourceBaseName
method.
A subclass may choose its own localization mechanism, if so
desired, by overriding the supplied implementations of
getElementDescription
and
getAttributeDescription
.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
AString
constant containing the standard format name,"javax_imageio_1.0"
.Fields inherited from interface javax.imageio.metadata.IIOMetadataFormat
CHILD_POLICY_ALL, CHILD_POLICY_CHOICE, CHILD_POLICY_EMPTY, CHILD_POLICY_MAX, CHILD_POLICY_REPEAT, CHILD_POLICY_SEQUENCE, CHILD_POLICY_SOME, DATATYPE_BOOLEAN, DATATYPE_DOUBLE, DATATYPE_FLOAT, DATATYPE_INTEGER, DATATYPE_STRING, VALUE_ARBITRARY, VALUE_ENUMERATION, VALUE_LIST, VALUE_NONE, VALUE_RANGE, VALUE_RANGE_MAX_INCLUSIVE, VALUE_RANGE_MAX_INCLUSIVE_MASK, VALUE_RANGE_MIN_INCLUSIVE, VALUE_RANGE_MIN_INCLUSIVE_MASK, VALUE_RANGE_MIN_MAX_INCLUSIVE
-
Constructor Summary
ConstructorDescriptionIIOMetadataFormatImpl
(String rootName, int childPolicy) Constructs a blankIIOMetadataFormatImpl
instance, with a given root element name and child policy (other thanCHILD_POLICY_REPEAT
).IIOMetadataFormatImpl
(String rootName, int minChildren, int maxChildren) Constructs a blankIIOMetadataFormatImpl
instance, with a given root element name and a child policy ofCHILD_POLICY_REPEAT
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAttribute
(String elementName, String attrName, int dataType, boolean required, int listMinLength, int listMaxLength) Adds a new attribute to a previously defined element that will be defined by a list of values.protected void
addAttribute
(String elementName, String attrName, int dataType, boolean required, String defaultValue) Adds a new attribute to a previously defined element that may be set to an arbitrary value.protected void
addAttribute
(String elementName, String attrName, int dataType, boolean required, String defaultValue, String minValue, String maxValue, boolean minInclusive, boolean maxInclusive) Adds a new attribute to a previously defined element that will be defined by a range of values.protected void
addAttribute
(String elementName, String attrName, int dataType, boolean required, String defaultValue, List<String> enumeratedValues) Adds a new attribute to a previously defined element that will be defined by a set of enumerated values.protected void
addBooleanAttribute
(String elementName, String attrName, boolean hasDefaultValue, boolean defaultValue) Adds a new attribute to a previously defined element that will be defined by the enumerated valuesTRUE
andFALSE
, with a datatype ofDATATYPE_BOOLEAN
.protected void
addChildElement
(String elementName, String parentName) Adds an existing element to the list of legal children for a given parent node type.protected void
addElement
(String elementName, String parentName, int childPolicy) Adds a new element type to this metadata document format with a child policy other thanCHILD_POLICY_REPEAT
.protected void
addElement
(String elementName, String parentName, int minChildren, int maxChildren) Adds a new element type to this metadata document format with a child policy ofCHILD_POLICY_REPEAT
.protected void
addObjectValue
(String elementName, Class<?> classType, int arrayMinLength, int arrayMaxLength) Allows anObject
reference of a given class type to be stored in nodes implementing the named element.protected <T> void
addObjectValue
(String elementName, Class<T> classType, boolean required, T defaultValue) Allows anObject
reference of a given class type to be stored in nodes implementing the named element.protected <T> void
addObjectValue
(String elementName, Class<T> classType, boolean required, T defaultValue, List<? extends T> enumeratedValues) Allows anObject
reference of a given class type to be stored in nodes implementing the named element.protected <T extends Object & Comparable<? super T>>
voidaddObjectValue
(String elementName, Class<T> classType, T defaultValue, Comparable<? super T> minValue, Comparable<? super T> maxValue, boolean minInclusive, boolean maxInclusive) Allows anObject
reference of a given class type to be stored in nodes implementing the named element.abstract 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.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.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.getAttributeMaxValue
(String elementName, String attrName) Returns the maximum legal value for the attribute.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.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.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.protected String
Returns the currently set base name for locatingResourceBundle
s.Returns the name of the root element of the format.static IIOMetadataFormat
Returns anIIOMetadataFormat
object describing the standard, plug-in neutraljavax.imageio_1.0
metadata document format described in the comment of thejavax.imageio.metadata
package.boolean
isAttributeRequired
(String elementName, String attrName) Returnstrue
if the named attribute must be present within the named element.protected void
removeAttribute
(String elementName, String attrName) Removes an attribute from a previously defined element.protected void
removeElement
(String elementName) Removes an element from the format.protected void
removeObjectValue
(String elementName) Disallows anObject
reference from being stored in nodes implementing the named element.protected void
setResourceBaseName
(String resourceBaseName) Sets a new base name for locatingResourceBundle
s containing descriptions of elements and attributes for this format.
-
Field Details
-
standardMetadataFormatName
AString
constant containing the standard format name,"javax_imageio_1.0"
.- See Also:
-
-
Constructor Details
-
IIOMetadataFormatImpl
Constructs a blankIIOMetadataFormatImpl
instance, with a given root element name and child policy (other thanCHILD_POLICY_REPEAT
). Additional elements, and their attributes andObject
reference information may be added using the variousadd
methods.- Parameters:
rootName
- the name of the root element.childPolicy
- one of theCHILD_POLICY_*
constants, other thanCHILD_POLICY_REPEAT
.- Throws:
IllegalArgumentException
- ifrootName
isnull
.IllegalArgumentException
- ifchildPolicy
is not one of the predefined constants.
-
IIOMetadataFormatImpl
Constructs a blankIIOMetadataFormatImpl
instance, with a given root element name and a child policy ofCHILD_POLICY_REPEAT
. Additional elements, and their attributes andObject
reference information may be added using the variousadd
methods.- Parameters:
rootName
- the name of the root element.minChildren
- the minimum number of children of the node.maxChildren
- the maximum number of children of the node.- Throws:
IllegalArgumentException
- ifrootName
isnull
.IllegalArgumentException
- ifminChildren
is negative or larger thanmaxChildren
.
-
-
Method Details
-
setResourceBaseName
Sets a new base name for locatingResourceBundle
s containing descriptions of elements and attributes for this format.Prior to the first time this method is called, the base name will be equal to
this.getClass().getName() + "Resources"
.- Parameters:
resourceBaseName
- aString
containing the new base name.- Throws:
IllegalArgumentException
- ifresourceBaseName
isnull
.- See Also:
-
getResourceBaseName
Returns the currently set base name for locatingResourceBundle
s.- Returns:
- a
String
containing the base name. - See Also:
-
addElement
Adds a new element type to this metadata document format with a child policy other thanCHILD_POLICY_REPEAT
.- Parameters:
elementName
- the name of the new element.parentName
- the name of the element that will be the parent of the new element.childPolicy
- one of theCHILD_POLICY_*
constants, other thanCHILD_POLICY_REPEAT
, indicating the child policy of the new element.- Throws:
IllegalArgumentException
- ifparentName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifchildPolicy
is not one of the predefined constants.
-
addElement
Adds a new element type to this metadata document format with a child policy ofCHILD_POLICY_REPEAT
.- Parameters:
elementName
- the name of the new element.parentName
- the name of the element that will be the parent of the new element.minChildren
- the minimum number of children of the node.maxChildren
- the maximum number of children of the node.- Throws:
IllegalArgumentException
- ifparentName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifminChildren
is negative or larger thanmaxChildren
.
-
addChildElement
Adds an existing element to the list of legal children for a given parent node type.- Parameters:
elementName
- the name of the element to be added as a child.parentName
- the name of the element that will be the new parent of the element.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifparentName
isnull
, or is not a legal element name for this format.
-
removeElement
Removes an element from the format. If no element with the given name was present, nothing happens and no exception is thrown.- Parameters:
elementName
- the name of the element to be removed.
-
addAttribute
protected void addAttribute(String elementName, String attrName, int dataType, boolean required, String defaultValue) Adds a new attribute to a previously defined element that may be set to an arbitrary value.- Parameters:
elementName
- the name of the element.attrName
- the name of the attribute being added.dataType
- the data type (string format) of the attribute, one of theDATATYPE_*
constants.required
-true
if the attribute must be present.defaultValue
- the default value for the attribute, ornull
.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifattrName
isnull
.IllegalArgumentException
- ifdataType
is not one of the predefined constants.
-
addAttribute
protected void addAttribute(String elementName, String attrName, int dataType, boolean required, String defaultValue, List<String> enumeratedValues) Adds a new attribute to a previously defined element that will be defined by a set of enumerated values.- Parameters:
elementName
- the name of the element.attrName
- the name of the attribute being added.dataType
- the data type (string format) of the attribute, one of theDATATYPE_*
constants.required
-true
if the attribute must be present.defaultValue
- the default value for the attribute, ornull
.enumeratedValues
- aList
ofString
s containing the legal values for the attribute.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifattrName
isnull
.IllegalArgumentException
- ifdataType
is not one of the predefined constants.IllegalArgumentException
- ifenumeratedValues
isnull
.IllegalArgumentException
- ifenumeratedValues
does not contain at least one entry.IllegalArgumentException
- ifenumeratedValues
contains an element that is not aString
or isnull
.
-
addAttribute
protected void addAttribute(String elementName, String attrName, int dataType, boolean required, String defaultValue, String minValue, String maxValue, boolean minInclusive, boolean maxInclusive) Adds a new attribute to a previously defined element that will be defined by a range of values.- Parameters:
elementName
- the name of the element.attrName
- the name of the attribute being added.dataType
- the data type (string format) of the attribute, one of theDATATYPE_*
constants.required
-true
if the attribute must be present.defaultValue
- the default value for the attribute, ornull
.minValue
- the smallest (inclusive or exclusive depending on the value ofminInclusive
) legal value for the attribute, as aString
.maxValue
- the largest (inclusive or exclusive depending on the value ofminInclusive
) legal value for the attribute, as aString
.minInclusive
-true
ifminValue
is inclusive.maxInclusive
-true
ifmaxValue
is inclusive.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifattrName
isnull
.IllegalArgumentException
- ifdataType
is not one of the predefined constants.
-
addAttribute
protected void addAttribute(String elementName, String attrName, int dataType, boolean required, int listMinLength, int listMaxLength) Adds a new attribute to a previously defined element that will be defined by a list of values.- Parameters:
elementName
- the name of the element.attrName
- the name of the attribute being added.dataType
- the data type (string format) of the attribute, one of theDATATYPE_*
constants.required
-true
if the attribute must be present.listMinLength
- the smallest legal number of list items.listMaxLength
- the largest legal number of list items.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifattrName
isnull
.IllegalArgumentException
- ifdataType
is not one of the predefined constants.IllegalArgumentException
- iflistMinLength
is negative or larger thanlistMaxLength
.
-
addBooleanAttribute
protected void addBooleanAttribute(String elementName, String attrName, boolean hasDefaultValue, boolean defaultValue) Adds a new attribute to a previously defined element that will be defined by the enumerated valuesTRUE
andFALSE
, with a datatype ofDATATYPE_BOOLEAN
.- Parameters:
elementName
- the name of the element.attrName
- the name of the attribute being added.hasDefaultValue
-true
if a default value should be present.defaultValue
- the default value for the attribute as aboolean
, ignored ifhasDefaultValue
isfalse
.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifattrName
isnull
.
-
removeAttribute
Removes an attribute from a previously defined element. If no attribute with the given name was present in the given element, nothing happens and no exception is thrown.- Parameters:
elementName
- the name of the element.attrName
- the name of the attribute being removed.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.
-
addObjectValue
protected <T> void addObjectValue(String elementName, Class<T> classType, boolean required, T defaultValue) Allows anObject
reference of a given class type to be stored in nodes implementing the named element. The value of theObject
is unconstrained other than by its class type.If an
Object
reference was previously allowed, the previous settings are overwritten.- Type Parameters:
T
- the type of the object.- Parameters:
elementName
- the name of the element.classType
- aClass
variable indicating the legal class type for the object value.required
-true
if an object value must be present.defaultValue
- the default value for theObject
reference, ornull
.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.
-
addObjectValue
protected <T> void addObjectValue(String elementName, Class<T> classType, boolean required, T defaultValue, List<? extends T> enumeratedValues) Allows anObject
reference of a given class type to be stored in nodes implementing the named element. The value of theObject
must be one of the values given byenumeratedValues
.If an
Object
reference was previously allowed, the previous settings are overwritten.- Type Parameters:
T
- the type of the object.- Parameters:
elementName
- the name of the element.classType
- aClass
variable indicating the legal class type for the object value.required
-true
if an object value must be present.defaultValue
- the default value for theObject
reference, ornull
.enumeratedValues
- aList
ofObject
s containing the legal values for the object reference.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.IllegalArgumentException
- ifenumeratedValues
isnull
.IllegalArgumentException
- ifenumeratedValues
does not contain at least one entry.IllegalArgumentException
- ifenumeratedValues
contains an element that is not an instance of the class type denoted byclassType
or isnull
.
-
addObjectValue
protected <T extends Object & Comparable<? super T>> void addObjectValue(String elementName, Class<T> classType, T defaultValue, Comparable<? super T> minValue, Comparable<? super T> maxValue, boolean minInclusive, boolean maxInclusive) Allows anObject
reference of a given class type to be stored in nodes implementing the named element. The value of theObject
must be within the range given byminValue
andmaxValue
. Furthermore, the class type must implement theComparable
interface.If an
Object
reference was previously allowed, the previous settings are overwritten.- Type Parameters:
T
- the type of the object.- Parameters:
elementName
- the name of the element.classType
- aClass
variable indicating the legal class type for the object value.defaultValue
- the default value for theminValue
- the smallest (inclusive or exclusive depending on the value ofminInclusive
) legal value for the object value, as aString
.maxValue
- the largest (inclusive or exclusive depending on the value ofminInclusive
) legal value for the object value, as aString
.minInclusive
-true
ifminValue
is inclusive.maxInclusive
-true
ifmaxValue
is inclusive.- Throws:
IllegalArgumentException
- ifelementName
isnull
, or is not a legal element name for this format.
-
addObjectValue
protected void addObjectValue(String elementName, Class<?> classType, int arrayMinLength, int arrayMaxLength) Allows anObject
reference of a given class type to be stored in nodes implementing the named element. The value of theObject
must an array of objects of class type given byclassType
, with at leastarrayMinLength
and at mostarrayMaxLength
elements.If an
Object
reference was previously allowed, the previous settings are overwritten.- Parameters:
elementName
- the name of the element.classType
- aClass
variable indicating the legal class type for the object value.arrayMinLength
- the smallest legal length for the array.arrayMaxLength
- the largest legal length for the array.- Throws:
IllegalArgumentException
- ifelementName
is not a legal element name for this format.
-
removeObjectValue
Disallows anObject
reference from being stored in nodes implementing the named element.- Parameters:
elementName
- the name of the element.- Throws:
IllegalArgumentException
- ifelementName
is not a legal element name for this format.
-
getRootName
Description copied from interface:IIOMetadataFormat
Returns the name of the root element of the format.- Specified by:
getRootName
in interfaceIIOMetadataFormat
- Returns:
- a
String
.
-
canNodeAppear
Description copied from interface:IIOMetadataFormat
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.- Specified by:
canNodeAppear
in interfaceIIOMetadataFormat
- 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
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getElementMinChildren
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- an
int
.
-
getElementMaxChildren
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getElementMaxChildren
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- an
int
.
-
getElementDescription
Returns aString
containing a description of the named element, ornull
. The description will be localized for the suppliedLocale
if possible.The default implementation will first locate a
ResourceBundle
using the current resource base name set bysetResourceBaseName
and the suppliedLocale
, using the fallback mechanism described in the comments forResourceBundle.getBundle
. If aResourceBundle
is found, the element name will be used as a key to itsgetString
method, and the result returned. If noResourceBundle
is found, or no such key is present,null
will be returned.If
locale
isnull
, the current defaultLocale
returned byLocale.getLocale
will be used.- Specified by:
getElementDescription
in interfaceIIOMetadataFormat
- 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.- See Also:
-
getChildPolicy
Description copied from interface:IIOMetadataFormat
Returns one of the constants starting withCHILD_POLICY_
, indicating the legal pattern of children for the named element.- Specified by:
getChildPolicy
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- one of the
CHILD_POLICY_*
constants.
-
getChildNames
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getChildNames
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- an array of
String
s, or null.
-
getAttributeNames
Description copied from interface:IIOMetadataFormat
Returns an array ofString
s listing the names of the attributes that may be associated with the named element.- Specified by:
getAttributeNames
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- an array of
String
s.
-
getAttributeValueType
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getAttributeValueType
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.attrName
- the name of the attribute being queried.- Returns:
- one of the
VALUE_*
constants.
-
getAttributeDataType
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getAttributeDataType
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.attrName
- the name of the attribute being queried.- Returns:
- one of the
DATATYPE_*
constants.
-
isAttributeRequired
Description copied from interface:IIOMetadataFormat
Returnstrue
if the named attribute must be present within the named element.- Specified by:
isAttributeRequired
in interfaceIIOMetadataFormat
- 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.
-
getAttributeDefaultValue
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getAttributeDefaultValue
in interfaceIIOMetadataFormat
- 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
.
-
getAttributeEnumerations
Description copied from interface:IIOMetadataFormat
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
.- Specified by:
getAttributeEnumerations
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.attrName
- the name of the attribute being queried.- Returns:
- an array of
String
s.
-
getAttributeMinValue
Description copied from interface:IIOMetadataFormat
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_*
.- Specified by:
getAttributeMinValue
in interfaceIIOMetadataFormat
- 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.
-
getAttributeMaxValue
Description copied from interface:IIOMetadataFormat
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_*
.- Specified by:
getAttributeMaxValue
in interfaceIIOMetadataFormat
- 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.
-
getAttributeListMinLength
Description copied from interface:IIOMetadataFormat
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
.- Specified by:
getAttributeListMinLength
in interfaceIIOMetadataFormat
- 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.
-
getAttributeListMaxLength
Description copied from interface:IIOMetadataFormat
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
.- Specified by:
getAttributeListMaxLength
in interfaceIIOMetadataFormat
- 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.
-
getAttributeDescription
Returns aString
containing a description of the named attribute, ornull
. The description will be localized for the suppliedLocale
if possible.The default implementation will first locate a
ResourceBundle
using the current resource base name set bysetResourceBaseName
and the suppliedLocale
, using the fallback mechanism described in the comments forResourceBundle.getBundle
. If aResourceBundle
is found, the element name followed by a "/" character followed by the attribute name (elementName + "/" + attrName
) will be used as a key to itsgetString
method, and the result returned. If noResourceBundle
is found, or no such key is present,null
will be returned.If
locale
isnull
, the current defaultLocale
returned byLocale.getLocale
will be used.- Specified by:
getAttributeDescription
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element.attrName
- the name of the attribute.locale
- theLocale
for which localization will be attempted, ornull
.- 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.- See Also:
-
getObjectValueType
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getObjectValueType
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- one of the
VALUE_*
constants. - See Also:
-
getObjectClass
Description copied from interface:IIOMetadataFormat
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.- Specified by:
getObjectClass
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- a
Class
object.
-
getObjectDefaultValue
Description copied from interface:IIOMetadataFormat
Returns anObject
s containing the default value for theObject
reference within the named element.- Specified by:
getObjectDefaultValue
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- an
Object
.
-
getObjectEnumerations
Description copied from interface:IIOMetadataFormat
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).- Specified by:
getObjectEnumerations
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- an array of
Object
s.
-
getObjectMinValue
Description copied from interface:IIOMetadataFormat
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
.- Specified by:
getObjectMinValue
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- the smallest legal value for the attribute.
-
getObjectMaxValue
Description copied from interface:IIOMetadataFormat
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
.- Specified by:
getObjectMaxValue
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- the smallest legal value for the attribute.
-
getObjectArrayMinLength
Description copied from interface:IIOMetadataFormat
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
.- Specified by:
getObjectArrayMinLength
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- the smallest valid array length for the
Object
reference.
-
getObjectArrayMaxLength
Description copied from interface:IIOMetadataFormat
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
.- Specified by:
getObjectArrayMaxLength
in interfaceIIOMetadataFormat
- Parameters:
elementName
- the name of the element being queried.- Returns:
- the largest valid array length for the
Object
reference.
-
getStandardFormatInstance
Returns anIIOMetadataFormat
object describing the standard, plug-in neutraljavax.imageio_1.0
metadata document format described in the comment of thejavax.imageio.metadata
package.- Returns:
- a predefined
IIOMetadataFormat
instance.
-