KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.netbeans.modules.javacore.jmiimpl.javamodel;
20
21 import java.util.Collection JavaDoc;
22 import java.util.Collections JavaDoc;
23 import java.util.List JavaDoc;
24 import javax.jmi.model.MofClass;
25 import javax.jmi.model.NameNotFoundException;
26 import javax.jmi.reflect.ConstraintViolationException;
27 import javax.jmi.reflect.RefObject;
28 import org.netbeans.jmi.javamodel.Element;
29 import org.netbeans.jmi.javamodel.ElementPartKind;
30 import org.netbeans.jmi.javamodel.PrimitiveType;
31 import org.netbeans.jmi.javamodel.PrimitiveTypeKind;
32 import org.netbeans.jmi.javamodel.Resource;
33 import org.netbeans.mdr.handlers.InstanceHandler;
34 import org.netbeans.mdr.storagemodel.StorableObject;
35
36 /**
37  *
38  * @author Martin Matula
39  */

40 public abstract class PrimitiveTypeImpl extends InstanceHandler implements PrimitiveType {
41     PrimitiveTypeKind kind = null;
42     
43     /** Creates a new instance of PackageImpl */
44     public PrimitiveTypeImpl(StorableObject s) {
45         super(s);
46     }
47     
48     public PrimitiveTypeKind getKind() {
49         return kind;
50     }
51     
52     public String JavaDoc getName() {
53         return kind.toString();
54     }
55     
56     public void setName() {
57         RefObject nameAttr = null;
58         try {
59             nameAttr = ((MofClass) refMetaObject()).lookupElementExtended("name"); // NOI18N
60
} catch (NameNotFoundException e) {
61             // ignore
62
}
63         throw new ConstraintViolationException(this, nameAttr, "Name is readonly."); // NOI18N
64
}
65
66     public void replaceChild(Element oldChild, Element newChild) {
67         throw new UnsupportedOperationException JavaDoc();
68     }
69
70     public int getPartStartOffset(ElementPartKind part) {
71         throw new UnsupportedOperationException JavaDoc();
72     }
73
74     public int getPartEndOffset(ElementPartKind part) {
75         throw new UnsupportedOperationException JavaDoc();
76     }
77
78     public Resource getResource() {
79         return null;
80     }
81
82     public void setName(String JavaDoc newValue) {
83         throw new UnsupportedOperationException JavaDoc();
84     }
85
86     public boolean isValid() {
87         return true;
88     }
89
90     public Collection JavaDoc getReferences() {
91         return Collections.EMPTY_LIST;
92     }
93
94     public Element duplicate() {
95         throw new UnsupportedOperationException JavaDoc();
96     }
97
98     public int getStartOffset() {
99         throw new UnsupportedOperationException JavaDoc();
100     }
101
102     public List JavaDoc getChildren() {
103         return Collections.EMPTY_LIST;
104     }
105
106     public int getEndOffset() {
107         throw new UnsupportedOperationException JavaDoc();
108     }
109 }
110
Popular Tags