KickJava   Java API By Example, From Geeks To Geeks.

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


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.AnnotationInstance;
21 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
22 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
23 import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier;
24 import org.apache.beehive.netui.compiler.typesystem.declaration.ParameterDeclaration;
25 import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
26 import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
27 import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
28 import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils;
29
30 import java.util.Set JavaDoc;
31 import java.util.HashSet JavaDoc;
32
33 public class AnnotationTypeElementDeclarationImpl
34         implements AnnotationTypeElementDeclaration
35 {
36     private String JavaDoc _name;
37     private TypeInstance _type;
38     private String JavaDoc _typeName;
39     private AnnotationValue _defaultVal;
40     private HashSet JavaDoc _validValues;
41     
42     public AnnotationTypeElementDeclarationImpl( String JavaDoc name, String JavaDoc typeName, Object JavaDoc defaultVal, HashSet JavaDoc validValues )
43     {
44         _name = name;
45         _typeName = typeName;
46         if ( defaultVal != null ) _defaultVal = new AnnotationValueImpl( defaultVal, null, this );
47         _validValues = validValues;
48     }
49
50     public boolean isValidValue( Object JavaDoc value )
51     {
52         return _validValues == null || _validValues.contains( value );
53     }
54     
55     public Set JavaDoc getValidValues()
56     {
57         return _validValues;
58     }
59     
60     public AnnotationValue getDefaultValue()
61     {
62         return _defaultVal;
63     }
64
65     public TypeInstance getReturnType()
66     {
67         if ( _typeName != null )
68         {
69             _type = XDocletCompilerUtils.resolveType( _typeName, false, null );
70             assert _type != null : "unresolvable type " + _typeName;
71             _typeName = null;
72         }
73         
74         return _type;
75     }
76
77     public ParameterDeclaration[] getParameters()
78     {
79         assert false : "NYI";
80         throw new UnsupportedOperationException JavaDoc( "NYI" );
81     }
82
83     public TypeDeclaration getDeclaringType()
84     {
85         assert false : "NYI";
86         throw new UnsupportedOperationException JavaDoc( "NYI" );
87     }
88
89     public AnnotationInstance[] getAnnotationInstances()
90     {
91         assert false : "NYI";
92         throw new UnsupportedOperationException JavaDoc( "NYI" );
93     }
94
95     public Set JavaDoc getModifiers()
96     {
97         assert false : "NYI";
98         throw new UnsupportedOperationException JavaDoc( "NYI" );
99     }
100
101     public String JavaDoc getSimpleName()
102     {
103         return _name;
104     }
105
106     public SourcePosition getPosition()
107     {
108         assert false : "NYI";
109         throw new UnsupportedOperationException JavaDoc( "NYI" );
110     }
111
112     public boolean hasModifier( Modifier modifier )
113     {
114         assert false : "NYI";
115         throw new UnsupportedOperationException JavaDoc( "NYI" );
116     }
117 }
118
Popular Tags