View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.view.facelets.compiler;
20  
21  import javax.faces.view.facelets.FaceletHandler;
22  import javax.faces.view.facelets.Tag;
23  import javax.faces.view.facelets.TagConfig;
24  
25  import org.apache.myfaces.view.facelets.tag.TagLibrary;
26  
27  /**
28   * 
29   * @author Jacob Hookom
30   * @version $Id$
31   */
32  class TagUnit extends CompilationUnit implements TagConfig
33  {
34  
35      private final TagLibrary library;
36  
37      private final String id;
38  
39      private final Tag tag;
40  
41      private final String namespace;
42  
43      private final String name;
44  
45      public TagUnit(TagLibrary library, String namespace, String name, Tag tag, String id)
46      {
47          this.library = library;
48          this.tag = tag;
49          this.namespace = namespace;
50          this.name = name;
51          this.id = id;
52      }
53  
54      public FaceletHandler createFaceletHandler()
55      {
56          return this.library.createTagHandler(this.namespace, this.name, this);
57      }
58  
59      public FaceletHandler getNextHandler()
60      {
61          return this.getNextFaceletHandler();
62      }
63  
64      public Tag getTag()
65      {
66          return this.tag;
67      }
68  
69      public String getTagId()
70      {
71          return this.id;
72      }
73  
74      public String toString()
75      {
76          return this.tag.toString();
77      }
78  
79  }