KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > compiler > typesystem > impl > type > DeclaredTypeImpl


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.type;
19
20 import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
21 import org.apache.beehive.netui.compiler.typesystem.impl.WrapperFactory;
22 import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType;
23 import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
24
25 import java.util.Collection JavaDoc;
26
27 public class DeclaredTypeImpl
28         extends ReferenceTypeImpl
29         implements DeclaredType
30 {
31     private InterfaceType[] _superInterfaces;
32     
33     public DeclaredTypeImpl( com.sun.mirror.type.DeclaredType delegate )
34     {
35         super( delegate );
36     }
37     
38     public TypeDeclaration getDeclaration()
39     {
40         return WrapperFactory.get().getTypeDeclaration( getDelegate().getDeclaration() );
41     }
42
43     public DeclaredType getContainingType()
44     {
45         return WrapperFactory.get().getDeclaredType( getDelegate().getContainingType() );
46     }
47
48     /*
49     public TypeInstance[] getActualTypeArguments()
50     {
51         return new TypeInstance[0];
52     }
53     */

54
55     public InterfaceType[] getSuperinterfaces()
56     {
57         if ( _superInterfaces == null )
58         {
59             Collection JavaDoc<com.sun.mirror.type.InterfaceType> delegateCollection = getDelegate().getSuperinterfaces();
60             InterfaceType[] array = new InterfaceType[delegateCollection.size()];
61             int j = 0;
62             for ( com.sun.mirror.type.InterfaceType i : delegateCollection )
63             {
64                 array[j++] = WrapperFactory.get().getInterfaceType( i );
65             }
66             _superInterfaces = array;
67         }
68
69         return _superInterfaces;
70     }
71     
72     protected com.sun.mirror.type.DeclaredType getDelegate()
73     {
74         return ( com.sun.mirror.type.DeclaredType ) super.getDelegate();
75     }
76 }
77
Popular Tags