KickJava   Java API By Example, From Geeks To Geeks.

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


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.*;
22 import org.netbeans.mdr.storagemodel.StorableClass;
23 import java.util.List JavaDoc;
24
25 /**
26  *
27  * @author Martin Matula
28  */

29 public abstract class EnumConstantClassImpl extends SemiPersistentClass implements EnumConstantClass {
30
31     protected EnumConstantClassImpl(StorableClass s) {
32         super(s);
33     }
34
35     public EnumConstant createEnumConstant() {
36         return create(null, null, null, null, null, null, null);
37     }
38
39     public EnumConstant createEnumConstant(String JavaDoc name, List JavaDoc annotations, int modifiers, String JavaDoc javadocText, JavaDoc javadoc, boolean isFinal, TypeReference typeName, int dimCount, InitialValue initialValue, String JavaDoc initialValueText, ClassDefinition body) {
40         return create(name, annotations, javadocText, javadoc, initialValue, initialValueText, body);
41     }
42
43     private EnumConstantImpl create(String JavaDoc name, List JavaDoc annotations, String JavaDoc javadocText, JavaDoc javadoc, InitialValue initialValue, String JavaDoc initialValueText, ClassDefinition body) {
44         EnumConstantImpl result = create(name, false);
45         result.setNew();
46         result.setData(annotations, javadocText, javadoc, initialValue, initialValueText, body);
47         return result;
48     }
49
50     public EnumConstantImpl create(String JavaDoc name, boolean isTransient) {
51         if (isTransient) {
52             EnumConstantImpl result = (EnumConstantImpl) createTransient();
53             boolean changes = result.disableChanges;
54             result.disableChanges = true;
55             try {
56                 result.setName(name);
57             } finally {
58                 result.disableChanges = changes;
59             }
60             return result;
61         } else {
62             return (EnumConstantImpl) super_createEnumConstant(name, null, 0, null, null, false, null, 0, null, null, null);
63         }
64     }
65
66     protected abstract EnumConstant super_createEnumConstant();
67     protected abstract EnumConstant super_createEnumConstant(String JavaDoc name, List JavaDoc annotations, int modifiers, String JavaDoc javadocText, JavaDoc javadoc, boolean isFinal, TypeReference typeName, int dimCount, InitialValue initialValue, String JavaDoc initialValueText, ClassDefinition body);
68 }
69
Popular Tags