KickJava   Java API By Example, From Geeks To Geeks.

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


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.declaration;
19
20 import org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration;
21 import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
22 import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
23 import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
24
25 import java.util.Collection JavaDoc;
26 import java.util.Iterator JavaDoc;
27
28 import xjavadoc.XPackage;
29 import xjavadoc.XClass;
30
31 public class PackageDeclarationImpl
32         extends DelegatingImpl
33         implements PackageDeclaration
34 {
35     private ClassDeclaration[] _classes;
36     
37     public PackageDeclarationImpl( XPackage delegate )
38     {
39         super( delegate );
40     }
41
42     public String JavaDoc getQualifiedName()
43     {
44         return getDelegateXPackage().getName();
45     }
46
47     public ClassDeclaration[] getClasses()
48     {
49         if ( _classes == null )
50         {
51             Collection JavaDoc delegateCollection = getDelegateXPackage().getClasses();
52             ClassDeclaration[] array = new ClassDeclaration[delegateCollection.size()];
53             int j = 0;
54             for ( Iterator JavaDoc i = delegateCollection.iterator(); i.hasNext(); )
55             {
56                 array[j++] = WrapperFactory.get().getClassDeclaration( ( XClass ) i.next() );
57             }
58             _classes = array;
59         }
60
61         return _classes;
62     }
63     
64     public XPackage getDelegateXPackage()
65     {
66         return ( XPackage ) super.getDelegate();
67     }
68 }
69
Popular Tags