KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > javacore > jmiimpl > javamodel > UnresolvedClassImpl


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.javacore.jmiimpl.javamodel;
21
22 import java.util.Collection JavaDoc;
23 import java.util.Collections JavaDoc;
24 import java.util.List JavaDoc;
25 import javax.jmi.model.MofClass;
26 import javax.jmi.model.NameNotFoundException;
27 import javax.jmi.reflect.ConstraintViolationException;
28 import javax.jmi.reflect.RefObject;
29 import org.netbeans.jmi.javamodel.*;
30 import org.netbeans.mdr.storagemodel.StorableObject;
31 import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
32 import org.netbeans.modules.javacore.parser.MDRParser;
33
34 /**
35  *
36  * @author Martin Matula
37  */

38 public abstract class UnresolvedClassImpl extends MetadataElement implements UnresolvedClass {
39     String JavaDoc name = null;
40     private static final String JavaDoc message = "Unresolved class does not support requested operation!"; // NOI18N
41

42     /** Creates a new instance of PackageImpl */
43     public UnresolvedClassImpl(StorableObject s) {
44         super(s);
45     }
46
47     protected void rollback() {
48     }
49
50     protected Object JavaDoc getInternalForm() {
51         return getName();
52     }
53     
54     public String JavaDoc getSourceText() {
55         return getName();
56     }
57     
58     public void getDiff(List JavaDoc diff) {
59     }
60     
61     public String JavaDoc getName() {
62         return name;
63     }
64     
65     public void setName(String JavaDoc name) {
66         RefObject nameAttr = null;
67         try {
68             nameAttr = ((MofClass) refMetaObject()).lookupElementExtended("name"); // NOI18N
69
} catch (NameNotFoundException e) {
70             // ignore
71
}
72         throw new ConstraintViolationException(this, nameAttr, "Name attribute is readonly."); // NOI18N
73
}
74
75     public Collection JavaDoc getReferences() {
76         return Collections.EMPTY_LIST;
77     }
78
79     public boolean isInterface() {
80         return false;
81     }
82     
83     public boolean isInner() {
84         return false;
85     }
86     
87     public ClassDefinition getDeclaringClass() {
88         return null;
89     }
90     
91     public JavaClass getSuperClass() {
92         if ("java.lang.Object".equals(name)) { // NOI18N
93
return null;
94         } else {
95             return (JavaClass) ((JavaModelPackage)refImmediatePackage()).getType().resolve("java.lang.Object"); // NOI18N
96
}
97     }
98     
99     public void setSuperClass(JavaClass jcls) {
100         throw new UnsupportedOperationException JavaDoc();
101     }
102     
103     public List JavaDoc getInterfaces() {
104         return Collections.EMPTY_LIST;
105     }
106     
107     public List JavaDoc getFeatures() {
108         return Collections.EMPTY_LIST;
109     }
110     
111     public void setSuperClassName(MultipartId newValue) {
112         throw new UnsupportedOperationException JavaDoc();
113     }
114     
115     public void setSimpleName(java.lang.String JavaDoc newValue) {
116          throw new UnsupportedOperationException JavaDoc();
117     }
118     
119     public void setModifiers(int newValue) {
120          throw new UnsupportedOperationException JavaDoc();
121     }
122     
123     public void setJavadocText(java.lang.String JavaDoc newValue) {
124          throw new UnsupportedOperationException JavaDoc();
125     }
126     
127     public void setJavadoc(JavaDoc newValue) {
128          throw new UnsupportedOperationException JavaDoc();
129     }
130     
131     public void setInterface(boolean newValue) {
132          throw new UnsupportedOperationException JavaDoc();
133     }
134     
135     public List JavaDoc getTypeParameters() {
136         return Collections.EMPTY_LIST;
137     }
138     
139     public MultipartId getSuperClassName() {
140         return null;
141     }
142     
143     public Collection JavaDoc getSubClasses() {
144         return Collections.EMPTY_LIST;
145     }
146     
147     public java.lang.String JavaDoc getSimpleName() {
148         return JavaClassImpl.getSimpleName(name);
149     }
150     
151     public int getModifiers() {
152         return 0;
153     }
154     
155     public int getSourceModifiers() {
156         return 0;
157     }
158     
159     public Method getMethod(java.lang.String JavaDoc name, List JavaDoc parameters, boolean includeSupertypes) {
160         return null;
161     }
162     
163     public java.lang.String JavaDoc getJavadocText() {
164         return null;
165     }
166     
167     public JavaDoc getJavadoc() {
168         return null;
169     }
170     
171     public List JavaDoc getInterfaceNames() {
172         return Collections.EMPTY_LIST;
173     }
174     
175     public JavaClass getInnerClass(java.lang.String JavaDoc simpleName, boolean includeSupertypes) {
176         return null;
177     }
178     
179     public Collection JavaDoc getImplementors() {
180         return Collections.EMPTY_LIST;
181     }
182     
183     public Field getField(java.lang.String JavaDoc name, boolean includeSupertypes) {
184         return null;
185     }
186     
187     public List JavaDoc getContents() {
188         return Collections.EMPTY_LIST;
189     }
190     
191     public Constructor getConstructor(List JavaDoc parameters, boolean includeSupertypes) {
192         return null;
193     }
194     
195     public List JavaDoc getAnnotations() {
196         return Collections.EMPTY_LIST;
197     }
198
199     public void replaceChild(Element element, Element element1) {
200         throw new UnsupportedOperationException JavaDoc(message);
201     }
202
203     public int getPartEndOffset(ElementPartKind elementPartKind) {
204         throw new UnsupportedOperationException JavaDoc(message);
205     }
206
207     public java.util.List JavaDoc getChildren() {
208         return Collections.EMPTY_LIST;
209     }
210
211     public int getStartOffset() {
212         throw new UnsupportedOperationException JavaDoc(message);
213     }
214
215     public java.util.Collection JavaDoc findSubTypes(boolean param) {
216         return Collections.EMPTY_LIST;
217     }
218
219     public int getPartStartOffset(ElementPartKind elementPartKind) {
220         throw new UnsupportedOperationException JavaDoc(message);
221     }
222
223     public Resource getResource() {
224         return null;
225     }
226
227     public boolean isDeprecated() {
228         return false;
229     }
230
231     public boolean isSubTypeOf(ClassDefinition classDefinition) {
232         if ("java.lang.Object".equals(classDefinition.getName()) || (this.equals(classDefinition))) { // NOI18N
233
return true;
234         } else {
235             return false;
236         }
237     }
238
239     public Element duplicate(JavaModelPackage targetExtent) {
240         throw new UnsupportedOperationException JavaDoc(message);
241     }
242
243     public boolean isValid() {
244         return true;
245     }
246     
247     public MDRParser getParser() {
248         return null;
249     }
250
251     public int getEndOffset() {
252         throw new UnsupportedOperationException JavaDoc(message);
253     }
254
255     public void setDeprecated(boolean param) {
256         throw new UnsupportedOperationException JavaDoc(message);
257     }
258     
259 }
260
Popular Tags