KickJava   Java API By Example, From Geeks To Geeks.

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


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.AnnotationTypeDeclaration;
21 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
22 import org.apache.beehive.netui.compiler.typesystem.impl.WrapperFactory;
23
24 import java.util.Collection JavaDoc;
25 import java.util.HashMap JavaDoc;
26
27 public class AnnotationTypeDeclarationImpl
28         extends InterfaceDeclarationImpl
29         implements AnnotationTypeDeclaration
30 {
31     private AnnotationTypeElementDeclaration[] _members;
32     private HashMap JavaDoc< String JavaDoc, AnnotationTypeElementDeclaration > _membersByName =
33             new HashMap JavaDoc< String JavaDoc, AnnotationTypeElementDeclaration >();
34     
35     public AnnotationTypeDeclarationImpl( com.sun.mirror.declaration.AnnotationTypeDeclaration delegate )
36     {
37         super( delegate );
38     }
39     
40     public AnnotationTypeElementDeclaration[] getAnnotationMembers()
41     {
42         if ( _members == null )
43         {
44             Collection JavaDoc< com.sun.mirror.declaration.AnnotationTypeElementDeclaration > delegateCollection =
45                     getDelegate().getMethods();
46             AnnotationTypeElementDeclaration[] array = new AnnotationTypeElementDeclaration[ delegateCollection.size() ];
47             int j = 0;
48             for ( com.sun.mirror.declaration.AnnotationTypeElementDeclaration i : delegateCollection )
49             {
50                 AnnotationTypeElementDeclaration decl = WrapperFactory.get().getAnnotationTypeElementDeclaration( i );
51                 array[ j++ ] = decl;
52                 _membersByName.put( decl.getSimpleName(), decl );
53             }
54             _members = array;
55         }
56
57         return _members;
58     }
59     
60     public com.sun.mirror.declaration.AnnotationTypeDeclaration getDelegate()
61     {
62         return ( com.sun.mirror.declaration.AnnotationTypeDeclaration ) super.getDelegate();
63     }
64
65     public AnnotationTypeElementDeclaration getMember( String JavaDoc name )
66     {
67         return _membersByName.get( name );
68     }
69 }
70
Popular Tags