KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > compiler > grammar > TilesDefinitionsConfigsType


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.grammar;
19
20 import org.apache.beehive.netui.compiler.AnnotationGrammar;
21 import org.apache.beehive.netui.compiler.FlowControllerInfo;
22 import org.apache.beehive.netui.compiler.FatalCompileTimeException;
23 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
24 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
25 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
26 import org.apache.beehive.netui.compiler.typesystem.declaration.MemberDeclaration;
27
28 import java.util.List JavaDoc;
29 import java.util.Iterator JavaDoc;
30
31 public class TilesDefinitionsConfigsType extends WebappPathType
32 {
33     public TilesDefinitionsConfigsType( String JavaDoc requiredRuntimeVersion, AnnotationGrammar parentGrammar,
34                                         FlowControllerInfo fcInfo )
35     {
36         super( false, requiredRuntimeVersion, parentGrammar, fcInfo );
37     }
38
39     
40     public Object JavaDoc onCheck( AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
41                            AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
42                            int annotationArrayIndex )
43             throws FatalCompileTimeException
44     {
45         List JavaDoc values = ( List JavaDoc ) value.getValue();
46
47         if ( values != null )
48         {
49             for ( Iterator JavaDoc ii = values.iterator(); ii.hasNext(); )
50             {
51                 AnnotationValue pathValue = ( AnnotationValue ) ii.next();
52
53                 if ( pathValue != null )
54                 {
55                     String JavaDoc filePath = ( String JavaDoc ) pathValue.getValue();
56                     if ( filePath == null || filePath.length() == 0 || filePath.charAt( 0 ) != '/' )
57                     {
58                         addError( value, "error.absolute-path-required-for-tiles-def" );
59                     }
60                 }
61
62                 super.onCheck( valueDecl, pathValue, parentAnnotations, classMember, annotationArrayIndex );
63             }
64         }
65
66         return null;
67     }
68
69     protected boolean checkAnyExtension()
70     {
71         return true;
72     }
73 }
74
Popular Tags