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