KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.beans.*;
25
26
27 /**
28  * The BaseProperty interface is the public (user) view of the schema2beans
29  * property objects BeanProp. See also BaseAttribute and the BaseBean
30  * introspection methods.
31  */

32 public interface BaseProperty {
33     public class VetoException extends RuntimeException JavaDoc {
34     PropertyVetoException pce;
35     
36     public VetoException(PropertyVetoException pce, String JavaDoc str) {
37         super(str);
38         this.pce = pce;
39     }
40     
41     public PropertyVetoException getPropertyVetoException() {
42         return this.pce;
43     }
44     }
45     
46     
47     /**
48      * Values returned by getInstanceType()
49      */

50     public static final int INSTANCE_OPTIONAL_ELT = Common.TYPE_0_1;
51     public static final int INSTANCE_MANDATORY_ELT = Common.TYPE_1;
52     public static final int INSTANCE_OPTIONAL_ARRAY = Common.TYPE_0_N;
53     public static final int INSTANCE_MANDATORY_ARRAY = Common.TYPE_1_N;
54     
55
56     /**
57      * Return true if this is the root property
58      */

59     public boolean isRoot();
60
61     /**
62      * Return the BaseBean for this property if there is one
63      */

64     public BaseBean getParent();
65
66     /**
67      * Return the name of the property as it is used in the bean class.
68      */

69     public String JavaDoc getName();
70     
71     /**
72      * Return the dtd name of the property, as it appears in the DTD file.
73      */

74     public String JavaDoc getDtdName();
75     
76     /**
77      * Return the class type of the property. If a wrapper is defined for
78      * the class, the class of the wrapper is returned instead of the
79      * java.lang.String class.
80      */

81     public Class JavaDoc getPropertyClass();
82     
83     /**
84      * Return true if the property is an indexed property.
85      */

86     public boolean isIndexed();
87     
88     /**
89      * Return true if the property is a bean (a node in the graph). Any
90      * object of the graph which is a bean is a subclass of BaseBean.
91      */

92     public boolean isBean();
93     
94     /**
95      * If the property is an indexed property, return the number of element
96      * (might contain null elements).
97      */

98     public int size();
99     
100     /**
101      * If the property has an attribute, return all the attribute names.
102      * Return an empty array of there is no attribute.
103      */

104     public String JavaDoc[] getAttributeNames();
105     
106     /**
107      * If the property has an attribute, return all the attributes
108      * definitions, as a list of BaseAttribute interfaces.
109      * The array is empty if there is no attribute.
110      */

111     public BaseAttribute[] getAttributes();
112     
113     /**
114      * Returns the full path name of the property (unique String name
115      * identifying the property for the lifetime of the graph).
116      */

117     public String JavaDoc getFullName(int index);
118     public String JavaDoc getFullName();
119     
120     /**
121      * Returns the instanciation type of the property. This might be one of
122      * the following:
123      *
124      * INSTANCE_OPTIONAL_ELT
125      * INSTANCE_MANDATORY_ELT
126      * INSTANCE_OPTIONAL_ARRAY
127      * INSTANCE_MANDATORY_ARRAY
128      */

129     public int getInstanceType();
130     
131     /**
132      * Returns true if this property is amoung a set of properties choice
133      * (DTD element such as (a | b | ...)
134      */

135     public boolean isChoiceProperty();
136     
137     
138     /**
139      * If this property is a choice property, returns all other choice
140      * properties associated to this one (including this one).
141      * If the current property is not a choice property, returns null.
142      */

143     public BaseProperty[] getChoiceProperties();
144     
145     /**
146      * Return true if the name is either equals to getName() or getDtdName()
147      */

148     public boolean hasName(String JavaDoc name);
149
150     /**
151      * Return true if this property matters when schema2beans compare graphs
152      */

153     public boolean isKey();
154 }
155
Popular Tags