KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.netbeans.jmi.javamodel.Field;
22 import org.netbeans.jmi.javamodel.FieldClass;
23 import org.netbeans.jmi.javamodel.TypeReference;
24 import org.netbeans.mdr.storagemodel.StorableClass;
25 import org.netbeans.modules.javacore.parser.TypeRef;
26
27 /**
28  * Implementation of Field class proxy interface.
29  *
30  * @author Vladimir Hudec
31  */

32 public abstract class FieldClassImpl extends SemiPersistentClass implements FieldClass {
33
34     protected FieldClassImpl(StorableClass s) {
35         super(s);
36     }
37     
38     /**
39      * The default factory operation used to create an instance object.
40      * @return The created instance object.
41      */

42     public Field createField() {
43         return create(null, null, false, null, 0, null, null, 0, null, null);
44     }
45     
46     /**
47      * Creates an instance object having attributes initialized by the passed
48      * values.
49      * @param name
50      * @param annotations
51      * @param isFinal
52      * @param initialValue
53      * @param initialValueText
54      * @param modifiers
55      * @param javadocText
56      * @param javadoc
57      * @return The created instance object.
58      */

59     public Field createField(java.lang.String JavaDoc name, java.util.List JavaDoc annotations, int modifiers, java.lang.String JavaDoc javadocText, org.netbeans.jmi.javamodel.JavaDoc javadoc, boolean isFinal, org.netbeans.jmi.javamodel.TypeReference typeName, int dimCount, org.netbeans.jmi.javamodel.InitialValue initialValue, java.lang.String JavaDoc initialValueText) {
60         return create(name, annotations, isFinal, typeName, dimCount, initialValue, initialValueText, modifiers, javadocText, javadoc);
61     }
62     
63     private Field create(java.lang.String JavaDoc name, java.util.List JavaDoc annotations, boolean isFinal, TypeReference typeName, int dimCount, org.netbeans.jmi.javamodel.InitialValue initialValue, java.lang.String JavaDoc initialValueText, int modifiers, java.lang.String JavaDoc javadocText, org.netbeans.jmi.javamodel.JavaDoc javadoc) {
64         FieldImpl result = create(name, modifiers, null, false);
65         result.setNew();
66         result.setData(annotations, modifiers, javadocText, javadoc, isFinal, typeName, dimCount, initialValue, initialValueText);
67         return result;
68     }
69
70     public FieldImpl create(String JavaDoc name, int modifiers, TypeRef type, boolean isTransient) {
71         FieldImpl result;
72         if (isTransient) {
73             result = (FieldImpl) createTransient();
74             boolean changes = result.disableChanges;
75             result.disableChanges = true;
76             try {
77                 result.setName(name);
78                 result.setModifiers(modifiers);
79             } finally {
80                 result.disableChanges = changes;
81             }
82         } else {
83             result = (FieldImpl) super_createField(name, null, modifiers, null, null, false, null, 0, null, null);
84         }
85         result.setTypeRef(type);
86         return result;
87     }
88
89     protected abstract Field super_createField();
90     protected abstract Field super_createField(java.lang.String JavaDoc name, java.util.List JavaDoc annotations, int modifiers, java.lang.String JavaDoc javadocText, org.netbeans.jmi.javamodel.JavaDoc javadoc, boolean isFinal, org.netbeans.jmi.javamodel.TypeReference typeName, int dimCount, org.netbeans.jmi.javamodel.InitialValue initialValue, java.lang.String JavaDoc initialValueText);
91 }
92
Popular Tags