Home | History | Annotate | Download | only in metadata
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 
     18 package javax.imageio.metadata;
     19 
     20 import javax.imageio.ImageTypeSpecifier;
     21 import java.util.Locale;
     22 
     23 /**
     24  * The Interface IIOMetadataFormat is implemented by classes that describe the
     25  * rules and allowed elements for a metadata document tree.
     26  *
     27  * @since Android 1.0
     28  */
     29 public interface IIOMetadataFormat {
     30 
     31     /**
     32      * The CHILD_POLICY_EMPTY.
     33      */
     34     int CHILD_POLICY_EMPTY = 0;
     35 
     36     /**
     37      * The CHILD_POLICY_ALL.
     38      */
     39     int CHILD_POLICY_ALL = 1;
     40 
     41     /**
     42      * The CHILD_POLICY_SOME.
     43      */
     44     int CHILD_POLICY_SOME = 2;
     45 
     46     /**
     47      * The CHILD_POLICY_CHOICE.
     48      */
     49     int CHILD_POLICY_CHOICE = 3;
     50 
     51     /**
     52      * The CHILD_POLICY_SEQUENCE.
     53      */
     54     int CHILD_POLICY_SEQUENCE = 4;
     55 
     56     /**
     57      * The CHILD_POLICY_REPEAT.
     58      */
     59     int CHILD_POLICY_REPEAT = 5;
     60 
     61     /**
     62      * The maximum value for the child policy.
     63      */
     64     int CHILD_POLICY_MAX = CHILD_POLICY_REPEAT;
     65 
     66     /**
     67      * The DATATYPE_STRING.
     68      */
     69     int DATATYPE_STRING = 0;
     70 
     71     /**
     72      * The DATATYPE_BOOLEAN.
     73      */
     74     int DATATYPE_BOOLEAN = 1;
     75 
     76     /**
     77      * The DATATYPE_INTEGER.
     78      */
     79     int DATATYPE_INTEGER = 2;
     80 
     81     /**
     82      * The DATATYPE_FLOAT.
     83      */
     84     int DATATYPE_FLOAT = 3;
     85 
     86     /**
     87      * The DATATYPE_DOUBLE.
     88      */
     89     int DATATYPE_DOUBLE = 4;
     90 
     91     /**
     92      * The VALUE_NONE.
     93      */
     94     int VALUE_NONE = 0;
     95 
     96     /**
     97      * The VALUE_ARBITRARY.
     98      */
     99     int VALUE_ARBITRARY = 1;
    100 
    101     /**
    102      * The VALUE_RANGE.
    103      */
    104     int VALUE_RANGE = 2;
    105 
    106     /**
    107      * The VALUE_RANGE_MIN_INCLUSIVE_MASK.
    108      */
    109     int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4;
    110 
    111     /**
    112      * The VALUE_RANGE_MAX_INCLUSIVE_MASK.
    113      */
    114     int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8;
    115 
    116     /**
    117      * The VALUE_ENUMERATION.
    118      */
    119     int VALUE_ENUMERATION = 16;
    120 
    121     /**
    122      * The VALUE_LIST.
    123      */
    124     int VALUE_LIST = 32;
    125 
    126     /**
    127      * The VALUE_RANGE_MIN_INCLUSIVE.
    128      */
    129     int VALUE_RANGE_MIN_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK;
    130 
    131     /**
    132      * The VALUE_RANGE_MAX_INCLUSIVE.
    133      */
    134     int VALUE_RANGE_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MAX_INCLUSIVE_MASK;
    135 
    136     /**
    137      * The VALUE_RANGE_MIN_MAX_INCLUSIVE.
    138      */
    139     int VALUE_RANGE_MIN_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK
    140             | VALUE_RANGE_MAX_INCLUSIVE_MASK;
    141 
    142     /**
    143      * Tells whether the specified element is allowed for the specified image
    144      * type.
    145      *
    146      * @param elementName
    147      *            the element name.
    148      * @param imageType
    149      *            the image type.
    150      * @return true, if the specified element is allowed for the specified image
    151      *         type.
    152      */
    153     boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType);
    154 
    155     /**
    156      * Gets data type of the specified attribute of the specified element.
    157      *
    158      * @param elementName
    159      *            the element name.
    160      * @param attrName
    161      *            the attribute name.
    162      * @return the attribute's data type.
    163      */
    164     int getAttributeDataType(String elementName, String attrName);
    165 
    166     /**
    167      * Gets the default value of the specified attribute of the specified
    168      * element.
    169      *
    170      * @param elementName
    171      *            the element name.
    172      * @param attrName
    173      *            the attribute name.
    174      * @return the attribute's default value.
    175      */
    176     String getAttributeDefaultValue(String elementName, String attrName);
    177 
    178     /**
    179      * Gets the user-friendly description of the attribute.
    180      *
    181      * @param elementName
    182      *            the element name.
    183      * @param attrName
    184      *            the attribute name.
    185      * @param locale
    186      *            the locale giving the desired language for the description.
    187      * @return the attribute description.
    188      */
    189     String getAttributeDescription(String elementName, String attrName, Locale locale);
    190 
    191     /**
    192      * Gets the attribute enumerations.
    193      *
    194      * @param elementName
    195      *            the element name.
    196      * @param attrName
    197      *            the attribute name.
    198      * @return the attribute enumerations.
    199      */
    200     String[] getAttributeEnumerations(String elementName, String attrName);
    201 
    202     /**
    203      * Gets the maximum length of the attribute list.
    204      *
    205      * @param elementName
    206      *            the element name.
    207      * @param attrName
    208      *            the attribute name.
    209      * @return the maximum length of the attribute list.
    210      */
    211     int getAttributeListMaxLength(String elementName, String attrName);
    212 
    213     /**
    214      * Gets the minimum length of the attribute list.
    215      *
    216      * @param elementName
    217      *            the element name.
    218      * @param attrName
    219      *            the attribute name.
    220      * @return the minimum length of the attribute list.
    221      */
    222     int getAttributeListMinLength(String elementName, String attrName);
    223 
    224     /**
    225      * Gets the maximum value allowed for the attribute.
    226      *
    227      * @param elementName
    228      *            the element name.
    229      * @param attrName
    230      *            the attribute name.
    231      * @return the maximum value allowed for the attribute.
    232      */
    233     String getAttributeMaxValue(String elementName, String attrName);
    234 
    235     /**
    236      * Gets the minimum value allowed for the attribute.
    237      *
    238      * @param elementName
    239      *            the element name.
    240      * @param attrName
    241      *            the attribute name.
    242      * @return the minimum value allowed for the attribute.
    243      */
    244     String getAttributeMinValue(String elementName, String attrName);
    245 
    246     /**
    247      * Gets the attribute names allowed for the specified element.
    248      *
    249      * @param elementName
    250      *            the element name.
    251      * @return the attribute names.
    252      */
    253     String[] getAttributeNames(String elementName);
    254 
    255     /**
    256      * Gets the attribute value type.
    257      *
    258      * @param elementName
    259      *            the element name.
    260      * @param attrName
    261      *            the attribute name.
    262      * @return the attribute value type.
    263      */
    264     int getAttributeValueType(String elementName, String attrName);
    265 
    266     /**
    267      * Checks whether the specified attribute is required for the specified
    268      * element.
    269      *
    270      * @param elementName
    271      *            the element name.
    272      * @param attrName
    273      *            the attribute name.
    274      * @return true, if the specified attribute is required for the specified
    275      *         element.
    276      */
    277     boolean isAttributeRequired(String elementName, String attrName);
    278 
    279     /**
    280      * Gets the names of the possible child elements for the given element.
    281      *
    282      * @param elementName
    283      *            the element name.
    284      * @return the child names.
    285      */
    286     String[] getChildNames(String elementName);
    287 
    288     /**
    289      * Gets the constant describing the element's child policy.
    290      *
    291      * @param elementName
    292      *            the element name.
    293      * @return the child policy.
    294      */
    295     int getChildPolicy(String elementName);
    296 
    297     /**
    298      * Gets the user-friendly description of the element.
    299      *
    300      * @param elementName
    301      *            the element name.
    302      * @param locale
    303      *            the locale giving the desired language for the description.
    304      * @return the element description.
    305      */
    306     String getElementDescription(String elementName, Locale locale);
    307 
    308     /**
    309      * Gets the maximum number of children allowed for the element.
    310      *
    311      * @param elementName
    312      *            the element name.
    313      * @return the maximum number of children allowed for the element.
    314      */
    315     int getElementMaxChildren(String elementName);
    316 
    317     /**
    318      * Gets the minimum number of children allowed for the element.
    319      *
    320      * @param elementName
    321      *            the element name.
    322      * @return the minimum number of children allowed for the element.
    323      */
    324     int getElementMinChildren(String elementName);
    325 
    326     /**
    327      * Gets the maximum object array length allowed for the element.
    328      *
    329      * @param elementName
    330      *            the element name.
    331      * @return the maximum object array length allowed for the element.
    332      */
    333     int getObjectArrayMaxLength(String elementName);
    334 
    335     /**
    336      * Gets the minimum object array length allowed for the element.
    337      *
    338      * @param elementName
    339      *            the element name.
    340      * @return the minimum object array length allowed for the element.
    341      */
    342     int getObjectArrayMinLength(String elementName);
    343 
    344     /**
    345      * Gets the object class corresponding to the specified element.
    346      *
    347      * @param elementName
    348      *            the element name.
    349      * @return the object class corresponding to the specified element.
    350      */
    351     Class<?> getObjectClass(String elementName);
    352 
    353     /**
    354      * Gets the object default value for the element.
    355      *
    356      * @param elementName
    357      *            the element name.
    358      * @return the object default value for the element.
    359      */
    360     Object getObjectDefaultValue(String elementName);
    361 
    362     /**
    363      * Gets the object enumerations.
    364      *
    365      * @param elementName
    366      *            the element name.
    367      * @return the object enumerations.
    368      */
    369     Object[] getObjectEnumerations(String elementName);
    370 
    371     /**
    372      * Gets the maximum value allowed for the element's object.
    373      *
    374      * @param elementName
    375      *            the element name.
    376      * @return the maximum value allowed for the element's object.
    377      */
    378     Comparable<?> getObjectMaxValue(String elementName);
    379 
    380     /**
    381      * Gets the minimum value allowed for the element's object.
    382      *
    383      * @param elementName
    384      *            the element name.
    385      * @return the minimum value allowed for the element's object.
    386      */
    387     Comparable<?> getObjectMinValue(String elementName);
    388 
    389     /**
    390      * Gets the constant that indicates the type of the element's value.
    391      *
    392      * @param elementName
    393      *            the element name.
    394      * @return the constant that indicates the type of the element's value.
    395      */
    396     int getObjectValueType(String elementName);
    397 
    398     /**
    399      * Gets the name of the root element.
    400      *
    401      * @return the name of the root element.
    402      */
    403     String getRootName();
    404 }
    405