KickJava   Java API By Example, From Geeks To Geeks.

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


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.List JavaDoc;
22 import org.netbeans.jmi.javamodel.*;
23 import org.netbeans.mdr.storagemodel.StorableClass;
24 import org.netbeans.modules.javacore.parser.TypeRef;
25
26 /**
27  *
28  * @author Pavel Flaska
29  */

30 public abstract class AttributeClassImpl extends SemiPersistentClass implements AttributeClass {
31
32     /** Creates a new instance of AttributeClassImpl */
33     public AttributeClassImpl(StorableClass s) {
34         super(s);
35     }
36
37     public Attribute createAttribute() {
38         return create(null, null, 0, null, null, null, null, null);
39     }
40     
41     public Attribute createAttribute(String JavaDoc name,
42                                      List JavaDoc annotations,
43                                      int modifiers,
44                                      String JavaDoc javadocText,
45                                      JavaDoc javadoc,
46                                      TypeReference typeName,
47                                      InitialValue defaultValue,
48                                      String JavaDoc defaultValueText)
49     {
50         return create(name, annotations, modifiers, javadocText, javadoc, typeName, defaultValue, defaultValueText);
51     }
52     
53     ////////////////////////////////////////////////////////////////////////////
54
protected AttributeImpl create(String JavaDoc name,
55                                    List JavaDoc annotations,
56                                    int modifiers,
57                                    String JavaDoc javadocText,
58                                    JavaDoc javadoc,
59                                    TypeReference typeName,
60                                    InitialValue defaultValue,
61                                    String JavaDoc defaultValueText)
62     {
63         AttributeImpl result;
64         result = (AttributeImpl) create(name, modifiers, null, false);
65         result.setNew();
66         result.setData(annotations, javadocText, javadoc, typeName, defaultValue, defaultValueText);
67         return result;
68     }
69     
70     public AttributeImpl create(String JavaDoc name, int modifiers, TypeRef type, boolean isTransient) {
71         AttributeImpl result;
72         if (isTransient) {
73             result = (AttributeImpl) 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 = (AttributeImpl) super_createAttribute(name, null, modifiers, null, null, null, null, null);
84         }
85         result.setTypeRef(type);
86         return result;
87     }
88     
89     protected abstract Attribute super_createAttribute();
90
91     protected abstract Attribute super_createAttribute(String JavaDoc name,
92                                  List JavaDoc annotations,
93                                  int modifiers,
94                                  String JavaDoc javadocText,
95                                  JavaDoc javadoc,
96                                  TypeReference typeName,
97                                  InitialValue defaultValue,
98                                  String JavaDoc defaultValueText);
99 }
100
Popular Tags