KickJava   Java API By Example, From Geeks To Geeks.

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


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.xdoclet.typesystem.impl.type;
19
20 import org.apache.beehive.netui.compiler.typesystem.type.ArrayType;
21 import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
22 import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
23 import xjavadoc.Type;
24
25 public class ArrayTypeImpl
26         extends ReferenceTypeImpl
27         implements ArrayType
28 {
29     public ArrayTypeImpl( Type delegate )
30     {
31         super( delegate );
32     }
33     
34     public TypeInstance getComponentType()
35     {
36         Type componentType = getDelegateType();
37         int dimension = componentType.getDimension();
38         assert dimension > 0 : "bad dimension " + dimension + " for array type " + componentType.getType();
39         return WrapperFactory.get().getTypeInstance( componentType.getType(), dimension - 1 );
40     }
41     
42     public Type getDelegateType()
43     {
44         return ( Type ) super.getDelegate();
45     }
46 }
47
Popular Tags