KickJava   Java API By Example, From Geeks To Geeks.

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


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.Arrays JavaDoc;
22 import java.util.List JavaDoc;
23
24 import org.netbeans.jmi.javamodel.Constructor;
25 import org.netbeans.jmi.javamodel.ConstructorClass;
26 import org.netbeans.jmi.javamodel.JavaDoc;
27 import org.netbeans.jmi.javamodel.StatementBlock;
28 import org.netbeans.mdr.storagemodel.StorableClass;
29 import org.netbeans.modules.javacore.parser.TypeParamRef;
30
31
32 /**
33  * Implementation of Constructor class proxy interface.
34  *
35  * @author Martin Matula, Vladimir Hudec
36  */

37 public abstract class ConstructorClassImpl extends SemiPersistentClass implements ConstructorClass {
38     protected ConstructorClassImpl(StorableClass s) {
39         super(s);
40     }
41     
42     /**
43      * The default factory operation used to create an instance object.
44      * @return The created instance object.
45      */

46     public Constructor createConstructor() {
47         return create(null, 0, null, null, null, null, null, null, null);
48     }
49     
50     public Constructor createConstructor(java.lang.String JavaDoc name, List JavaDoc annotations, int modifiers, java.lang.String JavaDoc javadocText, JavaDoc javadoc, StatementBlock body, java.lang.String JavaDoc bodyText, List JavaDoc typeArguments, List JavaDoc parameters, List JavaDoc exceptionNames) {
51         return create(annotations, modifiers, javadocText, javadoc, body, bodyText, typeArguments, parameters, exceptionNames);
52     }
53
54     private Constructor create(List JavaDoc annotations, int modifiers, java.lang.String JavaDoc javadocText, JavaDoc javadoc, StatementBlock body, java.lang.String JavaDoc bodyText, List JavaDoc typeArguments, List JavaDoc parameters, List JavaDoc exceptionNames) {
55         ConstructorImpl result = create(modifiers, null, false);
56         result.setNew();
57         result.setData(annotations, javadocText, javadoc, body, bodyText, typeArguments, parameters, exceptionNames);
58         return result;
59     }
60
61     public ConstructorImpl create(int modifiers, TypeParamRef[] exceptions, boolean isTransient) {
62         ConstructorImpl result;
63         if (isTransient) {
64             result = (ConstructorImpl) createTransient();
65             boolean changes = result.disableChanges;
66             result.disableChanges = true;
67             try {
68                 result.setModifiers(modifiers);
69             } finally {
70                 result.disableChanges = changes;
71             }
72         } else {
73             result = (ConstructorImpl) super_createConstructor(null, null, modifiers, null, null, null, null, null, null, null);
74         }
75         result.setExceptionRefs(exceptions == null ? null : Arrays.asList(exceptions));
76         return result;
77     }
78
79     protected abstract Constructor super_createConstructor();
80     protected abstract Constructor super_createConstructor(java.lang.String JavaDoc name, List JavaDoc annotations, int modifiers, java.lang.String JavaDoc javadocText, JavaDoc javadoc, StatementBlock body, java.lang.String JavaDoc bodyText, List JavaDoc typeArguments, List JavaDoc parameters, List JavaDoc exceptionNames);
81 }
82
Popular Tags