KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > compiler > xdoclet > 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.xdoclet.typesystem.impl.declaration;
19
20 import org.apache.beehive.netui.compiler.JpfLanguageConstants;
21 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
22 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration;
23 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
24 import org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration;
25 import org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration;
26 import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier;
27 import org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration;
28 import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
29 import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
30 import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
31
32 import java.util.HashMap JavaDoc;
33 import java.util.Set JavaDoc;
34
35 public class AnnotationTypeDeclarationImpl
36         implements AnnotationTypeDeclaration, JpfLanguageConstants
37 {
38     private String JavaDoc _annotationName;
39     private String JavaDoc _packageName;
40     private String JavaDoc _intermediateName;
41     private AnnotationTypeElementDeclaration[] _members;
42     private HashMap JavaDoc _membersByName;
43     
44     public AnnotationTypeDeclarationImpl( String JavaDoc annotationName, String JavaDoc interfaceQualifier,
45                                           String JavaDoc packageName, AnnotationTypeElementDeclaration[] members )
46     {
47         _annotationName = annotationName;
48         _intermediateName = interfaceQualifier != null ? interfaceQualifier + annotationName : annotationName;
49         _packageName = packageName;
50         _members = members;
51         
52         _membersByName = new HashMap JavaDoc();
53         for ( int i = 0; i < members.length; i++ )
54         {
55             AnnotationTypeElementDeclaration member = members[i];
56             _membersByName.put( member.getSimpleName(), member );
57         }
58     }
59     
60     public AnnotationTypeDeclarationImpl( AnnotationTypeDeclarationImpl source, String JavaDoc annotationName,
61                                           String JavaDoc interfaceQualifier )
62     {
63         _annotationName = annotationName;
64         _intermediateName = interfaceQualifier != null ? interfaceQualifier + annotationName : annotationName;
65         _packageName = source._packageName;
66         _members = source._members;
67         _membersByName = source._membersByName;
68     }
69     
70     public AnnotationTypeElementDeclaration[] getAnnotationMembers()
71     {
72         return _members;
73     }
74
75     public AnnotationTypeElementDeclaration getMember( String JavaDoc name )
76     {
77         return ( AnnotationTypeElementDeclaration ) _membersByName.get( name );
78     }
79     
80     public PackageDeclaration getPackage()
81     {
82         assert false : "NYI";
83         throw new UnsupportedOperationException JavaDoc( "NYI" );
84     }
85
86     public String JavaDoc getQualifiedName()
87     {
88         return _packageName + '.' + _intermediateName;
89     }
90
91     public InterfaceType[] getSuperinterfaces()
92     {
93         assert false : "NYI";
94         throw new UnsupportedOperationException JavaDoc( "NYI" );
95     }
96
97     public FieldDeclaration[] getFields()
98     {
99         assert false : "NYI";
100         throw new UnsupportedOperationException JavaDoc( "NYI" );
101     }
102
103     public MethodDeclaration[] getMethods()
104     {
105         assert false : "NYI";
106         throw new UnsupportedOperationException JavaDoc( "NYI" );
107     }
108
109     public TypeDeclaration[] getNestedTypes()
110     {
111         assert false : "NYI";
112         throw new UnsupportedOperationException JavaDoc( "NYI" );
113     }
114
115     public TypeDeclaration getDeclaringType()
116     {
117         assert false : "NYI";
118         throw new UnsupportedOperationException JavaDoc( "NYI" );
119     }
120
121     public String JavaDoc getDocComment()
122     {
123         assert false : "NYI";
124         throw new UnsupportedOperationException JavaDoc( "NYI" );
125     }
126
127     public AnnotationInstance[] getAnnotationInstances()
128     {
129         assert false : "NYI";
130         throw new UnsupportedOperationException JavaDoc( "NYI" );
131     }
132
133     public Set JavaDoc getModifiers()
134     {
135         assert false : "NYI";
136         throw new UnsupportedOperationException JavaDoc( "NYI" );
137     }
138
139     public String JavaDoc getSimpleName()
140     {
141         return _annotationName;
142     }
143     
144     public String JavaDoc getIntermediateName()
145     {
146         return _intermediateName;
147     }
148
149     public SourcePosition getPosition()
150     {
151         assert false : "NYI";
152         throw new UnsupportedOperationException JavaDoc( "NYI" );
153     }
154
155     public boolean hasModifier( Modifier modifier )
156     {
157         assert false : "NYI";
158         throw new UnsupportedOperationException JavaDoc( "NYI" );
159     }
160     
161     public boolean equals( Object JavaDoc o )
162     {
163         if ( o == null ) return false;
164         if ( o == this ) return true;
165         if ( ! ( o instanceof AnnotationTypeDeclarationImpl ) ) return false;
166         return getQualifiedName().equals( ( ( AnnotationTypeDeclarationImpl ) o ).getQualifiedName() );
167     }
168 }
169
Popular Tags