KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > model > SchemaComponent


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.xml.schema.model;
21
22 import javax.xml.namespace.QName JavaDoc;
23 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor;
24 import org.netbeans.modules.xml.xam.dom.DocumentComponent;
25 import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
26
27 /**
28  * This interface represents a common interface shared by all schema elements.
29  * @author Chris Webster
30  */

31 public interface SchemaComponent extends DocumentComponent<SchemaComponent> {
32
33     // TODO Should there be a resolve capability and expose uri for references
34
public static final String JavaDoc ANNOTATION_PROPERTY = "annotation";
35     public static final String JavaDoc ID_PROPERTY = "id";
36     
37     /**
38      * @return the schema model this component belongs to.
39      */

40     SchemaModel getModel();
41     
42     /**
43      * @return schema component 'id' attribute if presents, null otherwise.
44      */

45     String JavaDoc getId();
46     
47     /**
48      * Set the schema component 'id' attribute value.
49      */

50     void setId(String JavaDoc id);
51     
52     /**
53      * Returns value of an attribute defined in a certain namespace.
54      */

55     String JavaDoc getAnyAttribute(QName JavaDoc attributeName);
56     
57     /**
58      * Sets value of an attribute defined in a certain namespace.
59      * Propery change event will be fired with property name using attribute local name.
60      */

61     void setAnyAttribute(QName JavaDoc attributeName, String JavaDoc value);
62     
63     /**
64      **/

65     public Annotation getAnnotation();
66     
67     /**
68      **/

69     public void setAnnotation(Annotation annotation);
70     
71     /**
72      * Visitor providing
73      */

74     void accept(SchemaVisitor visitor);
75     
76     /**
77      * @return true if the elements are from the same schema model.
78      */

79     boolean fromSameModel(SchemaComponent other);
80     
81     /**
82      * Returns the type of the component in terms of the schema model interfaces
83      *
84      */

85     Class JavaDoc<? extends SchemaComponent> getComponentType();
86     
87     /**
88      * Creates a global reference to the given target Schema component.
89      * @param referenced the schema component being referenced.
90      * @param type actual type of the target
91      * @return the reference.
92      */

93     <T extends ReferenceableSchemaComponent> NamedComponentReference<T> createReferenceTo(T referenced, Class JavaDoc<T> type);
94 }
95
Popular Tags