KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > compiler > typesystem > impl > declaration > ClassDeclarationImpl


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.compiler.typesystem.impl.declaration;
19
20 import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
21 import org.apache.beehive.netui.compiler.typesystem.declaration.ConstructorDeclaration;
22 import org.apache.beehive.netui.compiler.typesystem.impl.WrapperFactory;
23 import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
24
25 import java.util.Collection JavaDoc;
26
27 public class ClassDeclarationImpl
28         extends TypeDeclarationImpl
29         implements ClassDeclaration
30 {
31     private ConstructorDeclaration[] _constructors;
32     
33     public ClassDeclarationImpl( com.sun.mirror.declaration.ClassDeclaration delegate )
34     {
35         super( delegate );
36     }
37
38     public ClassType getSuperclass()
39     {
40         return WrapperFactory.get().getClassType( getDelegate().getSuperclass() );
41     }
42
43     public ConstructorDeclaration[] getConstructors()
44     {
45         if ( _constructors == null )
46         {
47             Collection JavaDoc<com.sun.mirror.declaration.ConstructorDeclaration> delegateCollection = getDelegate().getConstructors();
48             ConstructorDeclaration[] array = new ConstructorDeclaration[delegateCollection.size()];
49             int j = 0;
50             for ( com.sun.mirror.declaration.ConstructorDeclaration i : delegateCollection )
51             {
52                 array[j++] = WrapperFactory.get().getConstructorDeclaration( i );
53             }
54             _constructors = array;
55         }
56
57         return _constructors;
58     }
59     
60     protected com.sun.mirror.declaration.ClassDeclaration getDelegate()
61     {
62         return ( com.sun.mirror.declaration.ClassDeclaration ) super.getDelegate();
63     }
64 }
65
Popular Tags