author | alanb |
Fri, 07 Apr 2017 08:05:54 +0000 | |
changeset 44545 | 83b611b88ac8 |
parent 36511 | 9d0388c6b336 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
21278
diff
changeset
|
2 |
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package javax.imageio.metadata; |
|
27 |
||
28 |
import java.util.Locale; |
|
29 |
import javax.imageio.ImageTypeSpecifier; |
|
30 |
||
31 |
/** |
|
32 |
* An object describing the structure of metadata documents returned |
|
35667 | 33 |
* from {@code IIOMetadata.getAsTree} and passed to |
34 |
* {@code IIOMetadata.setFromTree} and {@code mergeTree}. |
|
2 | 35 |
* Document structures are described by a set of constraints on the |
36 |
* type and number of child elements that may belong to a given parent |
|
37 |
* element type, the names, types, and values of attributes that may |
|
38 |
* belong to an element, and the type and values of |
|
35667 | 39 |
* {@code Object} reference that may be stored at a node. |
2 | 40 |
* |
41 |
* <p> N.B: classes that implement this interface should contain a |
|
35667 | 42 |
* method declared as {@code public static getInstance()} which |
21278 | 43 |
* returns an instance of the class. Commonly, an implementation will |
2 | 44 |
* construct only a single instance and cache it for future |
35667 | 45 |
* invocations of {@code getInstance}. |
36511 | 46 |
* <p> In the event that the plugin is provided as part of a named module, |
47 |
* that module must export the package containing the implementation class |
|
48 |
* to the <pre>java.desktop</pre> module via a qualified export. |
|
49 |
* An unqualified export is not recommended unless also needed for |
|
50 |
* some other reason. Failing to export the package will result in |
|
51 |
* access failure at runtime. |
|
2 | 52 |
* |
53 |
* <p> The structures that may be described by this class are a subset |
|
54 |
* of those expressible using XML document type definitions (DTDs), |
|
55 |
* with the addition of some basic information on the datatypes of |
|
35667 | 56 |
* attributes and the ability to store an {@code Object} |
2 | 57 |
* reference within a node. In the future, XML Schemas could be used |
58 |
* to represent these structures, and many others. |
|
59 |
* |
|
60 |
* <p> The differences between |
|
35667 | 61 |
* {@code IIOMetadataFormat}-described structures and DTDs are as |
2 | 62 |
* follows: |
63 |
* |
|
64 |
* <ul> |
|
65 |
* <li> Elements may not contain text or mix text with embedded |
|
66 |
* tags. |
|
67 |
* |
|
68 |
* <li> The children of an element must conform to one of a few simple |
|
69 |
* patterns, described in the documentation for the |
|
35667 | 70 |
* {@code CHILD_*} constants; |
2 | 71 |
* |
72 |
* <li> The in-memory representation of an elements may contain a |
|
35667 | 73 |
* reference to an {@code Object}. There is no provision for |
2 | 74 |
* representing such objects textually. |
75 |
* </ul> |
|
76 |
* |
|
77 |
*/ |
|
78 |
public interface IIOMetadataFormat { |
|
79 |
||
80 |
// Child policies |
|
81 |
||
82 |
/** |
|
35667 | 83 |
* A constant returned by {@code getChildPolicy} to indicate |
2 | 84 |
* that an element may not have any children. In other words, it |
85 |
* is required to be a leaf node. |
|
86 |
*/ |
|
87 |
int CHILD_POLICY_EMPTY = 0; |
|
88 |
||
89 |
/** |
|
35667 | 90 |
* A constant returned by {@code getChildPolicy} to indicate |
2 | 91 |
* that an element must have a single instance of each of its |
92 |
* legal child elements, in order. In DTD terms, the contents of |
|
35667 | 93 |
* the element are defined by a sequence {@code a,b,c,d,...}. |
2 | 94 |
*/ |
95 |
int CHILD_POLICY_ALL = 1; |
|
96 |
||
97 |
/** |
|
35667 | 98 |
* A constant returned by {@code getChildPolicy} to indicate |
2 | 99 |
* that an element must have zero or one instance of each of its |
100 |
* legal child elements, in order. In DTD terms, the contents of |
|
101 |
* the element are defined by a sequence |
|
35667 | 102 |
* {@code a?,b?,c?,d?,...}. |
2 | 103 |
*/ |
104 |
int CHILD_POLICY_SOME = 2; |
|
105 |
||
106 |
/** |
|
35667 | 107 |
* A constant returned by {@code getChildPolicy} to indicate |
2 | 108 |
* that an element must have zero or one children, selected from |
109 |
* among its legal child elements. In DTD terms, the contents of |
|
110 |
* the element are defined by a selection |
|
35667 | 111 |
* {@code a|b|c|d|...}. |
2 | 112 |
*/ |
113 |
int CHILD_POLICY_CHOICE = 3; |
|
114 |
||
115 |
/** |
|
35667 | 116 |
* A constant returned by {@code getChildPolicy} to indicate |
2 | 117 |
* that an element must have a sequence of instances of any of its |
118 |
* legal child elements. In DTD terms, the contents of the |
|
35667 | 119 |
* element are defined by a sequence {@code (a|b|c|d|...)*}. |
2 | 120 |
*/ |
121 |
int CHILD_POLICY_SEQUENCE = 4; |
|
122 |
||
123 |
/** |
|
35667 | 124 |
* A constant returned by {@code getChildPolicy} to indicate |
2 | 125 |
* that an element must have zero or more instances of its unique |
126 |
* legal child element. In DTD terms, the contents of the element |
|
35667 | 127 |
* are defined by a starred expression {@code a*}. |
2 | 128 |
*/ |
129 |
int CHILD_POLICY_REPEAT = 5; |
|
130 |
||
131 |
/** |
|
35667 | 132 |
* The largest valid {@code CHILD_POLICY_*} constant, |
2 | 133 |
* to be used for range checks. |
134 |
*/ |
|
135 |
int CHILD_POLICY_MAX = CHILD_POLICY_REPEAT; |
|
136 |
||
137 |
/** |
|
35667 | 138 |
* A constant returned by {@code getObjectValueType} to |
2 | 139 |
* indicate the absence of a user object. |
140 |
*/ |
|
141 |
int VALUE_NONE = 0; |
|
142 |
||
143 |
/** |
|
35667 | 144 |
* A constant returned by {@code getAttributeValueType} and |
145 |
* {@code getObjectValueType} to indicate that the attribute |
|
2 | 146 |
* or user object may be set a single, arbitrary value. |
147 |
*/ |
|
148 |
int VALUE_ARBITRARY = 1; |
|
149 |
||
150 |
/** |
|
35667 | 151 |
* A constant returned by {@code getAttributeValueType} and |
152 |
* {@code getObjectValueType} to indicate that the attribute |
|
2 | 153 |
* or user object may be set a range of values. Both the minimum |
154 |
* and maximum values of the range are exclusive. It is |
|
155 |
* recommended that ranges of integers be inclusive on both ends, |
|
156 |
* and that exclusive ranges be used only for floating-point data. |
|
157 |
* |
|
158 |
* @see #VALUE_RANGE_MIN_MAX_INCLUSIVE |
|
159 |
*/ |
|
160 |
int VALUE_RANGE = 2; |
|
161 |
||
162 |
/** |
|
35667 | 163 |
* A value that may be or'ed with {@code VALUE_RANGE} to |
164 |
* obtain {@code VALUE_RANGE_MIN_INCLUSIVE}, and with |
|
165 |
* {@code VALUE_RANGE_MAX_INCLUSIVE} to obtain |
|
166 |
* {@code VALUE_RANGE_MIN_MAX_INCLUSIVE}. |
|
2 | 167 |
* |
168 |
* <p> Similarly, the value may be and'ed with the value of |
|
35667 | 169 |
* {@code getAttributeValueType} or |
170 |
* {@code getObjectValueType} to determine if the minimum |
|
2 | 171 |
* value of the range is inclusive. |
172 |
*/ |
|
173 |
int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4; |
|
174 |
||
175 |
/** |
|
35667 | 176 |
* A value that may be or'ed with {@code VALUE_RANGE} to |
177 |
* obtain {@code VALUE_RANGE_MAX_INCLUSIVE}, and with |
|
178 |
* {@code VALUE_RANGE_MIN_INCLUSIVE} to obtain |
|
179 |
* {@code VALUE_RANGE_MIN_MAX_INCLUSIVE}. |
|
2 | 180 |
* |
181 |
* <p> Similarly, the value may be and'ed with the value of |
|
35667 | 182 |
* {@code getAttributeValueType} or |
183 |
* {@code getObjectValueType} to determine if the maximum |
|
2 | 184 |
* value of the range is inclusive. |
185 |
*/ |
|
186 |
int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8; |
|
187 |
||
188 |
/** |
|
35667 | 189 |
* A constant returned by {@code getAttributeValueType} and |
190 |
* {@code getObjectValueType} to indicate that the attribute |
|
2 | 191 |
* or user object may be set to a range of values. The minimum |
192 |
* (but not the maximum) value of the range is inclusive. |
|
193 |
*/ |
|
194 |
int VALUE_RANGE_MIN_INCLUSIVE = VALUE_RANGE | |
|
195 |
VALUE_RANGE_MIN_INCLUSIVE_MASK; |
|
196 |
||
197 |
/** |
|
35667 | 198 |
* A constant returned by {@code getAttributeValueType} and |
199 |
* {@code getObjectValueType} to indicate that the attribute |
|
2 | 200 |
* or user object may be set to a range of values. The maximum |
201 |
* (but not the minimum) value of the range is inclusive. |
|
202 |
*/ |
|
203 |
int VALUE_RANGE_MAX_INCLUSIVE = VALUE_RANGE | |
|
204 |
VALUE_RANGE_MAX_INCLUSIVE_MASK; |
|
205 |
||
206 |
/** |
|
35667 | 207 |
* A constant returned by {@code getAttributeValueType} and |
208 |
* {@code getObjectValueType} to indicate that the attribute |
|
2 | 209 |
* or user object may be set a range of values. Both the minimum |
210 |
* and maximum values of the range are inclusive. It is |
|
211 |
* recommended that ranges of integers be inclusive on both ends, |
|
212 |
* and that exclusive ranges be used only for floating-point data. |
|
213 |
*/ |
|
214 |
int VALUE_RANGE_MIN_MAX_INCLUSIVE = |
|
215 |
VALUE_RANGE | |
|
216 |
VALUE_RANGE_MIN_INCLUSIVE_MASK | |
|
217 |
VALUE_RANGE_MAX_INCLUSIVE_MASK; |
|
218 |
||
219 |
/** |
|
35667 | 220 |
* A constant returned by {@code getAttributeValueType} and |
221 |
* {@code getObjectValueType} to indicate that the attribute |
|
2 | 222 |
* or user object may be set one of a number of enumerated values. |
223 |
* In the case of attributes, these values are |
|
35667 | 224 |
* {@code String}s; for objects, they are |
225 |
* {@code Object}s implementing a given class or interface. |
|
2 | 226 |
* |
35667 | 227 |
* <p> Attribute values of type {@code DATATYPE_BOOLEAN} |
2 | 228 |
* should be marked as enumerations. |
229 |
*/ |
|
230 |
int VALUE_ENUMERATION = 16; |
|
231 |
||
232 |
/** |
|
35667 | 233 |
* A constant returned by {@code getAttributeValueType} and |
234 |
* {@code getObjectValueType} to indicate that the attribute |
|
2 | 235 |
* or user object may be set to a list or array of values. In the |
236 |
* case of attributes, the list will consist of |
|
35667 | 237 |
* whitespace-separated values within a {@code String}; for |
2 | 238 |
* objects, an array will be used. |
239 |
*/ |
|
240 |
int VALUE_LIST = 32; |
|
241 |
||
242 |
/** |
|
35667 | 243 |
* A constant returned by {@code getAttributeDataType} |
2 | 244 |
* indicating that the value of an attribute is a general Unicode |
245 |
* string. |
|
246 |
*/ |
|
247 |
int DATATYPE_STRING = 0; |
|
248 |
||
249 |
/** |
|
35667 | 250 |
* A constant returned by {@code getAttributeDataType} |
2375
bb4dd76ca2c9
5082756: Image I/O plug-ins set metadata boolean attributes to "true" or "false"
bae
parents:
2
diff
changeset
|
251 |
* indicating that the value of an attribute is one of the boolean |
bb4dd76ca2c9
5082756: Image I/O plug-ins set metadata boolean attributes to "true" or "false"
bae
parents:
2
diff
changeset
|
252 |
* values 'true' or 'false'. |
bb4dd76ca2c9
5082756: Image I/O plug-ins set metadata boolean attributes to "true" or "false"
bae
parents:
2
diff
changeset
|
253 |
* Attribute values of type DATATYPE_BOOLEAN should be marked as |
bb4dd76ca2c9
5082756: Image I/O plug-ins set metadata boolean attributes to "true" or "false"
bae
parents:
2
diff
changeset
|
254 |
* enumerations, and the permitted values should be the string |
bb4dd76ca2c9
5082756: Image I/O plug-ins set metadata boolean attributes to "true" or "false"
bae
parents:
2
diff
changeset
|
255 |
* literal values "TRUE" or "FALSE", although a plugin may also |
bb4dd76ca2c9
5082756: Image I/O plug-ins set metadata boolean attributes to "true" or "false"
bae
parents:
2
diff
changeset
|
256 |
* recognise lower or mixed case equivalents. |
2 | 257 |
*/ |
258 |
int DATATYPE_BOOLEAN = 1; |
|
259 |
||
260 |
/** |
|
35667 | 261 |
* A constant returned by {@code getAttributeDataType} |
2 | 262 |
* indicating that the value of an attribute is a string |
263 |
* representation of an integer. |
|
264 |
*/ |
|
265 |
int DATATYPE_INTEGER = 2; |
|
266 |
||
267 |
/** |
|
35667 | 268 |
* A constant returned by {@code getAttributeDataType} |
2 | 269 |
* indicating that the value of an attribute is a string |
270 |
* representation of a decimal floating-point number. |
|
271 |
*/ |
|
272 |
int DATATYPE_FLOAT = 3; |
|
273 |
||
274 |
/** |
|
35667 | 275 |
* A constant returned by {@code getAttributeDataType} |
2 | 276 |
* indicating that the value of an attribute is a string |
277 |
* representation of a double-precision decimal floating-point |
|
278 |
* number. |
|
279 |
*/ |
|
280 |
int DATATYPE_DOUBLE = 4; |
|
281 |
||
282 |
// Root |
|
283 |
||
284 |
/** |
|
285 |
* Returns the name of the root element of the format. |
|
286 |
* |
|
35667 | 287 |
* @return a {@code String}. |
2 | 288 |
*/ |
289 |
String getRootName(); |
|
290 |
||
291 |
// Multiplicity |
|
292 |
||
293 |
/** |
|
35667 | 294 |
* Returns {@code true} if the element (and the subtree below |
2 | 295 |
* it) is allowed to appear in a metadata document for an image of |
35667 | 296 |
* the given type, defined by an {@code ImageTypeSpecifier}. |
2 | 297 |
* For example, a metadata document format might contain an |
298 |
* element that describes the primary colors of the image, which |
|
299 |
* would not be allowed when writing a grayscale image. |
|
300 |
* |
|
301 |
* @param elementName the name of the element being queried. |
|
35667 | 302 |
* @param imageType an {@code ImageTypeSpecifier} indicating |
2 | 303 |
* the type of the image that will be associated with the |
304 |
* metadata. |
|
305 |
* |
|
35667 | 306 |
* @return {@code true} if the node is meaningful for images |
2 | 307 |
* of the given type. |
308 |
*/ |
|
309 |
boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType); |
|
310 |
||
311 |
/** |
|
312 |
* Returns the minimum number of children of the named element |
|
35667 | 313 |
* with child policy {@code CHILD_POLICY_REPEAT}. For |
2 | 314 |
* example, an element representing color primary information |
315 |
* might be required to have at least 3 children, one for each |
|
21278 | 316 |
* primary. |
2 | 317 |
* |
318 |
* @param elementName the name of the element being queried. |
|
319 |
* |
|
35667 | 320 |
* @return an {@code int}. |
2 | 321 |
* |
35667 | 322 |
* @exception IllegalArgumentException if {@code elementName} |
323 |
* is {@code null} or is not a legal element name for this |
|
2 | 324 |
* format. |
325 |
* @exception IllegalArgumentException if the named element does |
|
35667 | 326 |
* not have a child policy of {@code CHILD_POLICY_REPEAT}. |
2 | 327 |
*/ |
328 |
int getElementMinChildren(String elementName); |
|
329 |
||
330 |
/** |
|
331 |
* Returns the maximum number of children of the named element |
|
35667 | 332 |
* with child policy {@code CHILD_POLICY_REPEAT}. For |
2 | 333 |
* example, an element representing an entry in an 8-bit color |
334 |
* palette might be allowed to repeat up to 256 times. A value of |
|
35667 | 335 |
* {@code Integer.MAX_VALUE} may be used to specify that |
2 | 336 |
* there is no upper bound. |
337 |
* |
|
338 |
* @param elementName the name of the element being queried. |
|
339 |
* |
|
35667 | 340 |
* @return an {@code int}. |
2 | 341 |
* |
35667 | 342 |
* @exception IllegalArgumentException if {@code elementName} |
343 |
* is {@code null} or is not a legal element name for this |
|
2 | 344 |
* format. |
345 |
* @exception IllegalArgumentException if the named element does |
|
35667 | 346 |
* not have a child policy of {@code CHILD_POLICY_REPEAT}. |
2 | 347 |
*/ |
348 |
int getElementMaxChildren(String elementName); |
|
349 |
||
350 |
/** |
|
35667 | 351 |
* Returns a {@code String} containing a description of the |
352 |
* named element, or {@code null}. The description will be |
|
353 |
* localized for the supplied {@code Locale} if possible. |
|
2 | 354 |
* |
35667 | 355 |
* <p> If {@code locale} is {@code null}, the current |
356 |
* default {@code Locale} returned by {@code Locale.getLocale} |
|
2 | 357 |
* will be used. |
358 |
* |
|
359 |
* @param elementName the name of the element. |
|
35667 | 360 |
* @param locale the {@code Locale} for which localization |
2 | 361 |
* will be attempted. |
362 |
* |
|
363 |
* @return the element description. |
|
364 |
* |
|
35667 | 365 |
* @exception IllegalArgumentException if {@code elementName} |
366 |
* is {@code null}, or is not a legal element name for this format. |
|
2 | 367 |
*/ |
368 |
String getElementDescription(String elementName, Locale locale); |
|
369 |
||
370 |
// Children |
|
371 |
||
372 |
/** |
|
373 |
* Returns one of the constants starting with |
|
35667 | 374 |
* {@code CHILD_POLICY_}, indicating the legal pattern of |
2 | 375 |
* children for the named element. |
376 |
* |
|
377 |
* @param elementName the name of the element being queried. |
|
378 |
* |
|
35667 | 379 |
* @return one of the {@code CHILD_POLICY_*} constants. |
2 | 380 |
* |
35667 | 381 |
* @exception IllegalArgumentException if {@code elementName} |
382 |
* is {@code null} or is not a legal element name for this |
|
2 | 383 |
* format. |
384 |
*/ |
|
385 |
int getChildPolicy(String elementName); |
|
386 |
||
387 |
/** |
|
35667 | 388 |
* Returns an array of {@code String}s indicating the names |
2 | 389 |
* of the element which are allowed to be children of the named |
390 |
* element, in the order in which they should appear. If the |
|
35667 | 391 |
* element cannot have children, {@code null} is returned. |
2 | 392 |
* |
393 |
* @param elementName the name of the element being queried. |
|
394 |
* |
|
35667 | 395 |
* @return an array of {@code String}s, or null. |
2 | 396 |
* |
35667 | 397 |
* @exception IllegalArgumentException if {@code elementName} |
398 |
* is {@code null} or is not a legal element name for this |
|
2 | 399 |
* format. |
400 |
*/ |
|
401 |
String[] getChildNames(String elementName); |
|
402 |
||
403 |
// Attributes |
|
404 |
||
405 |
/** |
|
35667 | 406 |
* Returns an array of {@code String}s listing the names of |
2 | 407 |
* the attributes that may be associated with the named element. |
408 |
* |
|
409 |
* @param elementName the name of the element being queried. |
|
410 |
* |
|
35667 | 411 |
* @return an array of {@code String}s. |
2 | 412 |
* |
35667 | 413 |
* @exception IllegalArgumentException if {@code elementName} |
414 |
* is {@code null} or is not a legal element name for this |
|
2 | 415 |
* format. |
416 |
*/ |
|
417 |
String[] getAttributeNames(String elementName); |
|
418 |
||
419 |
/** |
|
35667 | 420 |
* Returns one of the constants starting with {@code VALUE_}, |
2 | 421 |
* indicating whether the values of the given attribute within the |
422 |
* named element are arbitrary, constrained to lie within a |
|
423 |
* specified range, constrained to be one of a set of enumerated |
|
424 |
* values, or are a whitespace-separated list of arbitrary values. |
|
425 |
* |
|
426 |
* @param elementName the name of the element being queried. |
|
427 |
* @param attrName the name of the attribute being queried. |
|
428 |
* |
|
35667 | 429 |
* @return one of the {@code VALUE_*} constants. |
2 | 430 |
* |
35667 | 431 |
* @exception IllegalArgumentException if {@code elementName} |
432 |
* is {@code null} or is not a legal element name for this |
|
2 | 433 |
* format. |
35667 | 434 |
* @exception IllegalArgumentException if {@code attrName} is |
435 |
* {@code null} or is not a legal attribute name for this |
|
2 | 436 |
* element. |
437 |
*/ |
|
438 |
int getAttributeValueType(String elementName, String attrName); |
|
439 |
||
440 |
/** |
|
441 |
* Returns one of the constants starting with |
|
35667 | 442 |
* {@code DATATYPE_}, indicating the format and |
21278 | 443 |
* interpretation of the value of the given attribute within the |
35667 | 444 |
* named element. If {@code getAttributeValueType} returns |
445 |
* {@code VALUE_LIST}, then the legal value is a |
|
2 | 446 |
* whitespace-spearated list of values of the returned datatype. |
447 |
* |
|
448 |
* @param elementName the name of the element being queried. |
|
449 |
* @param attrName the name of the attribute being queried. |
|
450 |
* |
|
35667 | 451 |
* @return one of the {@code DATATYPE_*} constants. |
2 | 452 |
* |
35667 | 453 |
* @exception IllegalArgumentException if {@code elementName} |
454 |
* is {@code null} or is not a legal element name for this |
|
2 | 455 |
* format. |
35667 | 456 |
* @exception IllegalArgumentException if {@code attrName} is |
457 |
* {@code null} or is not a legal attribute name for this |
|
2 | 458 |
* element. |
459 |
*/ |
|
460 |
int getAttributeDataType(String elementName, String attrName); |
|
461 |
||
462 |
/** |
|
35667 | 463 |
* Returns {@code true} if the named attribute must be |
2 | 464 |
* present within the named element. |
465 |
* |
|
466 |
* @param elementName the name of the element being queried. |
|
467 |
* @param attrName the name of the attribute being queried. |
|
468 |
* |
|
35667 | 469 |
* @return {@code true} if the attribute must be present. |
2 | 470 |
* |
35667 | 471 |
* @exception IllegalArgumentException if {@code elementName} |
472 |
* is {@code null} or is not a legal element name for this |
|
2 | 473 |
* format. |
35667 | 474 |
* @exception IllegalArgumentException if {@code attrName} is |
475 |
* {@code null} or is not a legal attribute name for this |
|
2 | 476 |
* element. |
477 |
*/ |
|
478 |
boolean isAttributeRequired(String elementName, String attrName); |
|
479 |
||
480 |
/** |
|
481 |
* Returns the default value of the named attribute, if it is not |
|
21278 | 482 |
* explicitly present within the named element, as a |
35667 | 483 |
* {@code String}, or {@code null} if no default value |
2 | 484 |
* is available. |
485 |
* |
|
486 |
* @param elementName the name of the element being queried. |
|
487 |
* @param attrName the name of the attribute being queried. |
|
488 |
* |
|
35667 | 489 |
* @return a {@code String} containing the default value, or |
490 |
* {@code null}. |
|
2 | 491 |
* |
35667 | 492 |
* @exception IllegalArgumentException if {@code elementName} |
493 |
* is {@code null} or is not a legal element name for this |
|
2 | 494 |
* format. |
35667 | 495 |
* @exception IllegalArgumentException if {@code attrName} is |
496 |
* {@code null} or is not a legal attribute name for this |
|
2 | 497 |
* element. |
498 |
*/ |
|
499 |
String getAttributeDefaultValue(String elementName, String attrName); |
|
500 |
||
501 |
/** |
|
35667 | 502 |
* Returns an array of {@code String}s containing the legal |
2 | 503 |
* enumerated values for the given attribute within the named |
504 |
* element. This method should only be called if |
|
35667 | 505 |
* {@code getAttributeValueType} returns |
506 |
* {@code VALUE_ENUMERATION}. |
|
2 | 507 |
* |
508 |
* @param elementName the name of the element being queried. |
|
509 |
* @param attrName the name of the attribute being queried. |
|
510 |
* |
|
35667 | 511 |
* @return an array of {@code String}s. |
2 | 512 |
* |
35667 | 513 |
* @exception IllegalArgumentException if {@code elementName} |
514 |
* is {@code null} or is not a legal element name for this |
|
2 | 515 |
* format. |
35667 | 516 |
* @exception IllegalArgumentException if {@code attrName} is |
517 |
* {@code null} or is not a legal attribute name for this |
|
2 | 518 |
* element. |
519 |
* @exception IllegalArgumentException if the given attribute is |
|
520 |
* not defined as an enumeration. |
|
521 |
*/ |
|
522 |
String[] getAttributeEnumerations(String elementName, String attrName); |
|
523 |
||
524 |
/** |
|
525 |
* Returns the minimum legal value for the attribute. Whether |
|
526 |
* this value is inclusive or exclusive may be determined by the |
|
35667 | 527 |
* value of {@code getAttributeValueType}. The value is |
528 |
* returned as a {@code String}; its interpretation is |
|
529 |
* dependent on the value of {@code getAttributeDataType}. |
|
2 | 530 |
* This method should only be called if |
35667 | 531 |
* {@code getAttributeValueType} returns |
532 |
* {@code VALUE_RANGE_*}. |
|
2 | 533 |
* |
534 |
* @param elementName the name of the element being queried. |
|
535 |
* @param attrName the name of the attribute being queried. |
|
536 |
* |
|
35667 | 537 |
* @return a {@code String} containing the smallest legal |
2 | 538 |
* value for the attribute. |
539 |
* |
|
35667 | 540 |
* @exception IllegalArgumentException if {@code elementName} |
541 |
* is {@code null} or is not a legal element name for this |
|
2 | 542 |
* format. |
35667 | 543 |
* @exception IllegalArgumentException if {@code attrName} is |
544 |
* {@code null} or is not a legal attribute name for this |
|
2 | 545 |
* element. |
546 |
* @exception IllegalArgumentException if the given attribute is |
|
547 |
* not defined as a range. |
|
548 |
*/ |
|
549 |
String getAttributeMinValue(String elementName, String attrName); |
|
550 |
||
551 |
/** |
|
552 |
* Returns the maximum legal value for the attribute. Whether |
|
553 |
* this value is inclusive or exclusive may be determined by the |
|
35667 | 554 |
* value of {@code getAttributeValueType}. The value is |
555 |
* returned as a {@code String}; its interpretation is |
|
556 |
* dependent on the value of {@code getAttributeDataType}. |
|
2 | 557 |
* This method should only be called if |
35667 | 558 |
* {@code getAttributeValueType} returns |
559 |
* {@code VALUE_RANGE_*}. |
|
2 | 560 |
* |
561 |
* @param elementName the name of the element being queried, as a |
|
35667 | 562 |
* {@code String}. |
2 | 563 |
* @param attrName the name of the attribute being queried. |
564 |
* |
|
35667 | 565 |
* @return a {@code String} containing the largest legal |
2 | 566 |
* value for the attribute. |
567 |
* |
|
35667 | 568 |
* @exception IllegalArgumentException if {@code elementName} |
569 |
* is {@code null} or is not a legal element name for this |
|
2 | 570 |
* format. |
35667 | 571 |
* @exception IllegalArgumentException if {@code attrName} is |
572 |
* {@code null} or is not a legal attribute name for this |
|
2 | 573 |
* element. |
574 |
* @exception IllegalArgumentException if the given attribute is |
|
575 |
* not defined as a range. |
|
576 |
*/ |
|
577 |
String getAttributeMaxValue(String elementName, String attrName); |
|
578 |
||
579 |
/** |
|
580 |
* Returns the minimum number of list items that may be used to |
|
581 |
* define this attribute. The attribute itself is defined as a |
|
35667 | 582 |
* {@code String} containing multiple whitespace-separated |
2 | 583 |
* items. This method should only be called if |
35667 | 584 |
* {@code getAttributeValueType} returns |
585 |
* {@code VALUE_LIST}. |
|
2 | 586 |
* |
587 |
* @param elementName the name of the element being queried. |
|
588 |
* @param attrName the name of the attribute being queried. |
|
589 |
* |
|
590 |
* @return the smallest legal number of list items for the |
|
591 |
* attribute. |
|
592 |
* |
|
35667 | 593 |
* @exception IllegalArgumentException if {@code elementName} |
594 |
* is {@code null} or is not a legal element name for this |
|
2 | 595 |
* format. |
35667 | 596 |
* @exception IllegalArgumentException if {@code attrName} is |
597 |
* {@code null} or is not a legal attribute name for this |
|
2 | 598 |
* element. |
599 |
* @exception IllegalArgumentException if the given attribute is |
|
600 |
* not defined as a list. |
|
601 |
*/ |
|
602 |
int getAttributeListMinLength(String elementName, String attrName); |
|
603 |
||
604 |
/** |
|
605 |
* Returns the maximum number of list items that may be used to |
|
606 |
* define this attribute. A value of |
|
35667 | 607 |
* {@code Integer.MAX_VALUE} may be used to specify that |
2 | 608 |
* there is no upper bound. The attribute itself is defined as a |
35667 | 609 |
* {@code String} containing multiple whitespace-separated |
2 | 610 |
* items. This method should only be called if |
35667 | 611 |
* {@code getAttributeValueType} returns |
612 |
* {@code VALUE_LIST}. |
|
2 | 613 |
* |
614 |
* @param elementName the name of the element being queried. |
|
615 |
* @param attrName the name of the attribute being queried. |
|
616 |
* |
|
617 |
* @return the largest legal number of list items for the |
|
618 |
* attribute. |
|
619 |
* |
|
35667 | 620 |
* @exception IllegalArgumentException if {@code elementName} |
621 |
* is {@code null} or is not a legal element name for this |
|
2 | 622 |
* format. |
35667 | 623 |
* @exception IllegalArgumentException if {@code attrName} is |
624 |
* {@code null} or is not a legal attribute name for this |
|
2 | 625 |
* element. |
626 |
* @exception IllegalArgumentException if the given attribute is |
|
627 |
* not defined as a list. |
|
628 |
*/ |
|
629 |
int getAttributeListMaxLength(String elementName, String attrName); |
|
630 |
||
631 |
/** |
|
35667 | 632 |
* Returns a {@code String} containing a description of the |
633 |
* named attribute, or {@code null}. The description will be |
|
634 |
* localized for the supplied {@code Locale} if possible. |
|
2 | 635 |
* |
35667 | 636 |
* <p> If {@code locale} is {@code null}, the current |
637 |
* default {@code Locale} returned by {@code Locale.getLocale} |
|
2 | 638 |
* will be used. |
639 |
* |
|
640 |
* @param elementName the name of the element. |
|
641 |
* @param attrName the name of the attribute. |
|
35667 | 642 |
* @param locale the {@code Locale} for which localization |
2 | 643 |
* will be attempted. |
644 |
* |
|
645 |
* @return the attribute description. |
|
646 |
* |
|
35667 | 647 |
* @exception IllegalArgumentException if {@code elementName} |
648 |
* is {@code null}, or is not a legal element name for this format. |
|
649 |
* @exception IllegalArgumentException if {@code attrName} is |
|
650 |
* {@code null} or is not a legal attribute name for this |
|
2 | 651 |
* element. |
652 |
*/ |
|
653 |
String getAttributeDescription(String elementName, String attrName, |
|
654 |
Locale locale); |
|
655 |
||
656 |
// Object value |
|
657 |
||
658 |
/** |
|
659 |
* Returns one of the enumerated values starting with |
|
35667 | 660 |
* {@code VALUE_}, indicating the type of values |
2 | 661 |
* (enumeration, range, or array) that are allowed for the |
35667 | 662 |
* {@code Object} reference. If no object value can be |
2 | 663 |
* stored within the given element, the result of this method will |
35667 | 664 |
* be {@code VALUE_NONE}. |
2 | 665 |
* |
35667 | 666 |
* <p> {@code Object} references whose legal values are |
667 |
* defined as a range must implement the {@code Comparable} |
|
2 | 668 |
* interface. |
669 |
* |
|
670 |
* @param elementName the name of the element being queried. |
|
671 |
* |
|
35667 | 672 |
* @return one of the {@code VALUE_*} constants. |
2 | 673 |
* |
35667 | 674 |
* @exception IllegalArgumentException if {@code elementName} |
675 |
* is {@code null} or is not a legal element name for this |
|
2 | 676 |
* format. |
677 |
* |
|
678 |
* @see Comparable |
|
679 |
*/ |
|
680 |
int getObjectValueType(String elementName); |
|
681 |
||
682 |
/** |
|
35667 | 683 |
* Returns the {@code Class} type of the {@code Object} |
2 | 684 |
* reference stored within the element. If this element may not |
35667 | 685 |
* contain an {@code Object} reference, an |
686 |
* {@code IllegalArgumentException} will be thrown. If the |
|
2 | 687 |
* class type is an array, this field indicates the underlying |
35667 | 688 |
* class type (<i>e.g</i>, for an array of {@code int}s, this |
689 |
* method would return {@code int.class}). |
|
2 | 690 |
* |
35667 | 691 |
* <p> {@code Object} references whose legal values are |
692 |
* defined as a range must implement the {@code Comparable} |
|
2 | 693 |
* interface. |
694 |
* |
|
695 |
* @param elementName the name of the element being queried. |
|
696 |
* |
|
35667 | 697 |
* @return a {@code Class} object. |
2 | 698 |
* |
35667 | 699 |
* @exception IllegalArgumentException if {@code elementName} |
700 |
* is {@code null} or is not a legal element name for this |
|
2 | 701 |
* format. |
702 |
* @exception IllegalArgumentException if the named element cannot |
|
703 |
* contain an object value (<i>i.e.</i>, if |
|
35667 | 704 |
* {@code getObjectValueType(elementName) == VALUE_NONE}). |
2 | 705 |
*/ |
706 |
Class<?> getObjectClass(String elementName); |
|
707 |
||
708 |
/** |
|
35667 | 709 |
* Returns an {@code Object}s containing the default |
710 |
* value for the {@code Object} reference within |
|
2 | 711 |
* the named element. |
712 |
* |
|
713 |
* @param elementName the name of the element being queried. |
|
714 |
* |
|
35667 | 715 |
* @return an {@code Object}. |
2 | 716 |
* |
35667 | 717 |
* @exception IllegalArgumentException if {@code elementName} |
718 |
* is {@code null} or is not a legal element name for this |
|
2 | 719 |
* format. |
720 |
* @exception IllegalArgumentException if the named element cannot |
|
721 |
* contain an object value (<i>i.e.</i>, if |
|
35667 | 722 |
* {@code getObjectValueType(elementName) == VALUE_NONE}). |
2 | 723 |
*/ |
724 |
Object getObjectDefaultValue(String elementName); |
|
725 |
||
726 |
/** |
|
35667 | 727 |
* Returns an array of {@code Object}s containing the legal |
728 |
* enumerated values for the {@code Object} reference within |
|
2 | 729 |
* the named element. This method should only be called if |
35667 | 730 |
* {@code getObjectValueType} returns |
731 |
* {@code VALUE_ENUMERATION}. |
|
2 | 732 |
* |
35667 | 733 |
* <p> The {@code Object} associated with a node that accepts |
21278 | 734 |
* enumerated values must be equal to one of the values returned by |
35667 | 735 |
* this method, as defined by the {@code ==} operator (as |
736 |
* opposed to the {@code Object.equals} method). |
|
2 | 737 |
* |
738 |
* @param elementName the name of the element being queried. |
|
739 |
* |
|
35667 | 740 |
* @return an array of {@code Object}s. |
2 | 741 |
* |
35667 | 742 |
* @exception IllegalArgumentException if {@code elementName} |
743 |
* is {@code null} or is not a legal element name for this |
|
2 | 744 |
* format. |
745 |
* @exception IllegalArgumentException if the named element cannot |
|
746 |
* contain an object value (<i>i.e.</i>, if |
|
35667 | 747 |
* {@code getObjectValueType(elementName) == VALUE_NONE}). |
748 |
* @exception IllegalArgumentException if the {@code Object} |
|
2 | 749 |
* is not defined as an enumeration. |
750 |
*/ |
|
751 |
Object[] getObjectEnumerations(String elementName); |
|
752 |
||
753 |
/** |
|
35667 | 754 |
* Returns the minimum legal value for the {@code Object} |
2 | 755 |
* reference within the named element. Whether this value is |
756 |
* inclusive or exclusive may be determined by the value of |
|
35667 | 757 |
* {@code getObjectValueType}. This method should only be |
758 |
* called if {@code getObjectValueType} returns one of the |
|
759 |
* constants starting with {@code VALUE_RANGE}. |
|
2 | 760 |
* |
761 |
* @param elementName the name of the element being queried. |
|
762 |
* |
|
763 |
* @return the smallest legal value for the attribute. |
|
764 |
* |
|
35667 | 765 |
* @exception IllegalArgumentException if {@code elementName} |
766 |
* is {@code null} or is not a legal element name for this |
|
2 | 767 |
* format. |
768 |
* @exception IllegalArgumentException if the named element cannot |
|
769 |
* contain an object value (<i>i.e.</i>, if |
|
35667 | 770 |
* {@code getObjectValueType(elementName) == VALUE_NONE}). |
771 |
* @exception IllegalArgumentException if the {@code Object} |
|
2 | 772 |
* is not defined as a range. |
773 |
*/ |
|
774 |
Comparable<?> getObjectMinValue(String elementName); |
|
775 |
||
776 |
/** |
|
35667 | 777 |
* Returns the maximum legal value for the {@code Object} |
2 | 778 |
* reference within the named element. Whether this value is |
779 |
* inclusive or exclusive may be determined by the value of |
|
35667 | 780 |
* {@code getObjectValueType}. This method should only be |
781 |
* called if {@code getObjectValueType} returns one of the |
|
782 |
* constants starting with {@code VALUE_RANGE}. |
|
2 | 783 |
* |
784 |
* @return the smallest legal value for the attribute. |
|
785 |
* |
|
786 |
* @param elementName the name of the element being queried. |
|
787 |
* |
|
35667 | 788 |
* @exception IllegalArgumentException if {@code elementName} |
789 |
* is {@code null} or is not a legal element name for this |
|
2 | 790 |
* format. |
791 |
* @exception IllegalArgumentException if the named element cannot |
|
792 |
* contain an object value (<i>i.e.</i>, if |
|
35667 | 793 |
* {@code getObjectValueType(elementName) == VALUE_NONE}). |
794 |
* @exception IllegalArgumentException if the {@code Object} |
|
2 | 795 |
* is not defined as a range. |
796 |
*/ |
|
797 |
Comparable<?> getObjectMaxValue(String elementName); |
|
798 |
||
799 |
/** |
|
800 |
* Returns the minimum number of array elements that may be used |
|
35667 | 801 |
* to define the {@code Object} reference within the named |
2 | 802 |
* element. This method should only be called if |
35667 | 803 |
* {@code getObjectValueType} returns |
804 |
* {@code VALUE_LIST}. |
|
2 | 805 |
* |
806 |
* @param elementName the name of the element being queried. |
|
807 |
* |
|
808 |
* @return the smallest valid array length for the |
|
35667 | 809 |
* {@code Object} reference. |
2 | 810 |
* |
35667 | 811 |
* @exception IllegalArgumentException if {@code elementName} |
812 |
* is {@code null} or is not a legal element name for this |
|
2 | 813 |
* format. |
814 |
* @exception IllegalArgumentException if the named element cannot |
|
815 |
* contain an object value (<i>i.e.</i>, if |
|
35667 | 816 |
* {@code getObjectValueType(elementName) == VALUE_NONE}). |
817 |
* @exception IllegalArgumentException if the {@code Object} is not |
|
2 | 818 |
* an array. |
819 |
*/ |
|
820 |
int getObjectArrayMinLength(String elementName); |
|
821 |
||
822 |
/** |
|
823 |
* Returns the maximum number of array elements that may be used |
|
35667 | 824 |
* to define the {@code Object} reference within the named |
825 |
* element. A value of {@code Integer.MAX_VALUE} may be used |
|
2 | 826 |
* to specify that there is no upper bound. This method should |
35667 | 827 |
* only be called if {@code getObjectValueType} returns |
828 |
* {@code VALUE_LIST}. |
|
2 | 829 |
* |
830 |
* @param elementName the name of the element being queried. |
|
831 |
* |
|
832 |
* @return the largest valid array length for the |
|
35667 | 833 |
* {@code Object} reference. |
2 | 834 |
* |
35667 | 835 |
* @exception IllegalArgumentException if {@code elementName} |
836 |
* is {@code null} or is not a legal element name for this |
|
2 | 837 |
* format. |
838 |
* @exception IllegalArgumentException if the named element cannot |
|
839 |
* contain an object value (<i>i.e.</i>, if |
|
35667 | 840 |
* {@code getObjectValueType(elementName) == VALUE_NONE}). |
841 |
* @exception IllegalArgumentException if the {@code Object} is not |
|
2 | 842 |
* an array. |
843 |
*/ |
|
844 |
int getObjectArrayMaxLength(String elementName); |
|
845 |
} |