KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > tag > Tag


1 /**
2  * Licensed under the Common Development and Distribution License,
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.sun.com/cddl/
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11  * implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */

14
15 package com.sun.facelets.tag;
16
17 /**
18  * Representation of a Tag in the Facelet definition
19  *
20  * @author Jacob Hookom
21  * @version $Id: Tag.java,v 1.4 2005/08/24 04:38:48 jhook Exp $
22  */

23 public final class Tag {
24     private final TagAttributes attributes;
25
26     private final Location location;
27
28     private final String JavaDoc namespace;
29
30     private final String JavaDoc localName;
31
32     private final String JavaDoc qName;
33
34     public Tag(Location location, String JavaDoc namespace, String JavaDoc localName,
35             String JavaDoc qName, TagAttributes attributes) {
36         this.location = location;
37         this.namespace = namespace;
38         this.localName = localName;
39         this.qName = qName;
40         this.attributes = attributes;
41     }
42
43     public Tag(Tag orig, TagAttributes attributes) {
44         this(orig.getLocation(), orig.getNamespace(), orig.getLocalName(), orig
45                 .getQName(), attributes);
46     }
47
48     /**
49      * All TagAttributes specified
50      *
51      * @return all TagAttributes specified
52      */

53     public TagAttributes getAttributes() {
54         return attributes;
55     }
56
57     /**
58      * Local name of the tag <my:tag /> would be "tag"
59      *
60      * @return local name of the tag
61      */

62     public String JavaDoc getLocalName() {
63         return localName;
64     }
65
66     /**
67      * Location of the Tag in the Facelet file
68      *
69      * @return location of the Tag in the Facelet file
70      */

71     public Location getLocation() {
72         return location;
73     }
74
75     /**
76      * The resolved Namespace for this tag
77      *
78      * @return the resolved namespace for this tag
79      */

80     public String JavaDoc getNamespace() {
81         return namespace;
82     }
83
84     /**
85      * Get the qualified name for this tag <my:tag /> would be "my:tag"
86      *
87      * @return qualified name of the tag
88      */

89     public String JavaDoc getQName() {
90         return qName;
91     }
92
93     /*
94      * (non-Javadoc)
95      *
96      * @see java.lang.Object#toString()
97      */

98     public String JavaDoc toString() {
99         return this.location + " <" + this.qName + ">";
100     }
101 }
102
Popular Tags