KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > schema2beans > BaseAttribute


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.schema2beans;
21
22 import java.util.*;
23 import java.io.*;
24
25
26 /**
27  * The BaseBean introspection methods return BaseProperty and BaseAttribute
28  * objects. This interface is the attribute equivalent to the BaseProperty
29  * interface.
30  *
31  * This interface is the public access to the schema2beans internal attribute
32  * information (see AttrProp class for the implementation of this interface).
33  */

34 public interface BaseAttribute {
35     /**
36      * Values returned by getType()
37      **/

38     static public final int TYPE_CDATA = AttrProp.CDATA;
39     static public final int TYPE_ENUM = AttrProp.ENUM;
40     static public final int TYPE_NMTOKEN = AttrProp.NMTOKEN;
41     static public final int TYPE_ID = AttrProp.ID;
42     static public final int TYPE_IDREF = AttrProp.IDREF;
43     static public final int TYPE_IDREFS = AttrProp.IDREFS;
44     static public final int TYPE_ENTITY = AttrProp.ENTITY;
45     static public final int TYPE_ENTITIES = AttrProp.ENTITIES;
46     static public final int TYPE_NOTATION = AttrProp.NOTATION;
47     
48     /**
49      * Values returned by getOption()
50      */

51     static public final int OPTION_REQUIRED = AttrProp.REQUIRED;
52     static public final int OPTION_IMPLIED = AttrProp.IMPLIED;
53     static public final int OPTION_FIXED = AttrProp.FIXED;
54     
55     
56     /**
57      * Return the name of the attribute as it is used in the bean class.
58      */

59     public String JavaDoc getName();
60     
61     /**
62      * Return the dtd name of the attribute, as it appears in the DTD file.
63      */

64     public String JavaDoc getDtdName();
65     
66     /**
67      * Return true if the name is either equals to getName() or getDtdName()
68      */

69     public boolean hasName(String JavaDoc name);
70     
71     /**
72      * If the attribute is Enum, returns the list of possible values
73      */

74     public String JavaDoc[] getValues();
75     
76     /**
77      * Default value used when creating this attribute
78      */

79     public String JavaDoc getDefaultValue();
80     
81     /**
82      * True if the attribute is Enum
83      */

84     public boolean isEnum();
85     
86     /**
87      * True if the attribute has a fixed value
88      */

89     public boolean isFixed();
90     
91     /**
92      * Returns one of the following constants:
93      *
94      * OPTION_REQUIRED
95      * OPTION_IMPLIED
96      * OPTION_FIXED
97      */

98     public int getOption();
99     
100     /**
101      * Returns one of the following constants:
102      *
103      * TYPE_CDATA
104      * TYPE_ENUM
105      * TYPE_NMTOKEN
106      * TYPE_ID
107      * TYPE_IDREF
108      * TYPE_IDREFS
109      * TYPE_ENTITY
110      * TYPE_ENTITIES
111      * TYPE_NOTATION
112      */

113     public int getType();
114     
115     /**
116      * In general the attributes are defined in the DTD file,
117      * like the properties, and are therefore part of the bean structure,
118      * because part of the generated beans. This method returns false
119      * for such attributes.
120      * If an attribute is not declared in the DTD file but used in the XML
121      * document, the schema2beans consider such attributes as transient and
122      * add them, on the fly, into the bean structures. This method returns
123      * true for such attributes.
124      */

125     public boolean isTransient();
126 }
127
Popular Tags