KickJava   Java API By Example, From Geeks To Geeks.

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


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
20 package org.netbeans.modules.javacore.jmiimpl.javamodel;
21
22 import java.util.Arrays JavaDoc;
23 import java.util.List JavaDoc;
24 import org.netbeans.jmi.javamodel.*;
25 import org.netbeans.mdr.storagemodel.StorableClass;
26 import org.netbeans.modules.javacore.parser.TypeParamRef;
27
28 /**
29  * @author Pavel Flaska
30  */

31 public abstract class TypeParameterClassImpl extends SemiPersistentClass implements TypeParameterClass {
32
33     public TypeParameterClassImpl(StorableClass s) {
34         super(s);
35     }
36
37     public TypeParameter createTypeParameter() {
38         return create(null, (MultipartId) null, null);
39     }
40
41     public TypeParameter createTypeParameter(String JavaDoc name, List JavaDoc annotations, int modifiers, String JavaDoc javadocText, JavaDoc javadoc, List JavaDoc contents, MultipartId superClassName, List JavaDoc interfaceNames, List JavaDoc typeParameters) {
42         return create(name, superClassName, interfaceNames);
43     }
44
45     protected abstract TypeParameter super_createTypeParameter(String JavaDoc name, List JavaDoc annotations, int modifiers, String JavaDoc javadocText, JavaDoc javadoc, List JavaDoc contents, MultipartId superClassName, List JavaDoc interfaceNames, List JavaDoc typeParameters);
46
47     public TypeParameterImpl create(String JavaDoc name, TypeParamRef[] bounds, boolean isTransient) {
48         TypeParameterImpl result;
49         if (isTransient) {
50             result = (TypeParameterImpl) createTransient();
51             boolean changes = result.disableChanges;
52             result.disableChanges = true;
53             try {
54                 result.setName(name);
55             } finally {
56                 result.disableChanges = changes;
57             }
58         } else {
59             result = (TypeParameterImpl) super_createTypeParameter(name, null, 0, null, null, null, null, null, null);
60         }
61         result.setBoundsRef(bounds == null ? null : bounds);
62         return result;
63     }
64
65     private TypeParameter create(String JavaDoc name, MultipartId superClassName, List JavaDoc interfaceNames) {
66         TypeParameterImpl result = create(name, null, false);
67         result.setNew();
68         result.setData(superClassName, interfaceNames);
69         return result;
70     }
71     
72     public org.netbeans.jmi.javamodel.Type resolve(java.lang.String JavaDoc name) {
73         JavaModelPackage pkg = (JavaModelPackage) refImmediatePackage();
74         return pkg.getType().resolve(name);
75     }
76 }
77
Popular Tags