1 19 20 package org.netbeans.modules.javacore.jmiimpl.javamodel; 21 22 import java.util.Collection ; 23 import java.util.Collections ; 24 import java.util.List ; 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 38 public abstract class UnresolvedClassImpl extends MetadataElement implements UnresolvedClass { 39 String name = null; 40 private static final String message = "Unresolved class does not support requested operation!"; 42 43 public UnresolvedClassImpl(StorableObject s) { 44 super(s); 45 } 46 47 protected void rollback() { 48 } 49 50 protected Object getInternalForm() { 51 return getName(); 52 } 53 54 public String getSourceText() { 55 return getName(); 56 } 57 58 public void getDiff(List diff) { 59 } 60 61 public String getName() { 62 return name; 63 } 64 65 public void setName(String name) { 66 RefObject nameAttr = null; 67 try { 68 nameAttr = ((MofClass) refMetaObject()).lookupElementExtended("name"); } catch (NameNotFoundException e) { 70 } 72 throw new ConstraintViolationException(this, nameAttr, "Name attribute is readonly."); } 74 75 public Collection 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)) { return null; 94 } else { 95 return (JavaClass) ((JavaModelPackage)refImmediatePackage()).getType().resolve("java.lang.Object"); } 97 } 98 99 public void setSuperClass(JavaClass jcls) { 100 throw new UnsupportedOperationException (); 101 } 102 103 public List getInterfaces() { 104 return Collections.EMPTY_LIST; 105 } 106 107 public List getFeatures() { 108 return Collections.EMPTY_LIST; 109 } 110 111 public void setSuperClassName(MultipartId newValue) { 112 throw new UnsupportedOperationException (); 113 } 114 115 public void setSimpleName(java.lang.String newValue) { 116 throw new UnsupportedOperationException (); 117 } 118 119 public void setModifiers(int newValue) { 120 throw new UnsupportedOperationException (); 121 } 122 123 public void setJavadocText(java.lang.String newValue) { 124 throw new UnsupportedOperationException (); 125 } 126 127 public void setJavadoc(JavaDoc newValue) { 128 throw new UnsupportedOperationException (); 129 } 130 131 public void setInterface(boolean newValue) { 132 throw new UnsupportedOperationException (); 133 } 134 135 public List getTypeParameters() { 136 return Collections.EMPTY_LIST; 137 } 138 139 public MultipartId getSuperClassName() { 140 return null; 141 } 142 143 public Collection getSubClasses() { 144 return Collections.EMPTY_LIST; 145 } 146 147 public java.lang.String 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 name, List parameters, boolean includeSupertypes) { 160 return null; 161 } 162 163 public java.lang.String getJavadocText() { 164 return null; 165 } 166 167 public JavaDoc getJavadoc() { 168 return null; 169 } 170 171 public List getInterfaceNames() { 172 return Collections.EMPTY_LIST; 173 } 174 175 public JavaClass getInnerClass(java.lang.String simpleName, boolean includeSupertypes) { 176 return null; 177 } 178 179 public Collection getImplementors() { 180 return Collections.EMPTY_LIST; 181 } 182 183 public Field getField(java.lang.String name, boolean includeSupertypes) { 184 return null; 185 } 186 187 public List getContents() { 188 return Collections.EMPTY_LIST; 189 } 190 191 public Constructor getConstructor(List parameters, boolean includeSupertypes) { 192 return null; 193 } 194 195 public List getAnnotations() { 196 return Collections.EMPTY_LIST; 197 } 198 199 public void replaceChild(Element element, Element element1) { 200 throw new UnsupportedOperationException (message); 201 } 202 203 public int getPartEndOffset(ElementPartKind elementPartKind) { 204 throw new UnsupportedOperationException (message); 205 } 206 207 public java.util.List getChildren() { 208 return Collections.EMPTY_LIST; 209 } 210 211 public int getStartOffset() { 212 throw new UnsupportedOperationException (message); 213 } 214 215 public java.util.Collection findSubTypes(boolean param) { 216 return Collections.EMPTY_LIST; 217 } 218 219 public int getPartStartOffset(ElementPartKind elementPartKind) { 220 throw new UnsupportedOperationException (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))) { return true; 234 } else { 235 return false; 236 } 237 } 238 239 public Element duplicate(JavaModelPackage targetExtent) { 240 throw new UnsupportedOperationException (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 (message); 253 } 254 255 public void setDeprecated(boolean param) { 256 throw new UnsupportedOperationException (message); 257 } 258 259 } 260 | Popular Tags |