| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| StartElementToken |
|
| 0.0;0 |
| 1 | // Copyright 2006, 2009 The Apache Software Foundation | |
| 2 | // | |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 | // you may not use this file except in compliance with the License. | |
| 5 | // You may obtain a copy of the License at | |
| 6 | // | |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | // | |
| 9 | // Unless required by applicable law or agreed to in writing, software | |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 | // See the License for the specific language governing permissions and | |
| 13 | // limitations under the License. | |
| 14 | ||
| 15 | package org.apache.tapestry5.internal.parser; | |
| 16 | ||
| 17 | import org.apache.tapestry5.ioc.Location; | |
| 18 | ||
| 19 | /** | |
| 20 | * The start of an ordinary element within the template (as opposed to {@link org.apache.tapestry5.internal.parser.StartComponentToken}, | |
| 21 | * which represents an active Tapestry token. A start element token may be immediately followed by {@link | |
| 22 | * org.apache.tapestry5.internal.parser.AttributeToken}s that represents the attributes associated with the element. A | |
| 23 | * start element token will always be balanced by a {@link org.apache.tapestry5.internal.parser.EndElementToken} (though | |
| 24 | * there will likely be some amount of intermediate tokens). | |
| 25 | */ | |
| 26 | public class StartElementToken extends TemplateToken | |
| 27 | { | |
| 28 | private final String namespaceURI; | |
| 29 | ||
| 30 | private final String name; | |
| 31 | ||
| 32 | public StartElementToken(String namespaceURI, String name, Location location) | |
| 33 | { | |
| 34 | 2124 | super(TokenType.START_ELEMENT, location); |
| 35 | ||
| 36 | 2124 | this.namespaceURI = namespaceURI; |
| 37 | 2124 | this.name = name; |
| 38 | 2124 | } |
| 39 | ||
| 40 | /** | |
| 41 | * Returns local name for the element. | |
| 42 | */ | |
| 43 | public String getName() | |
| 44 | { | |
| 45 | 2236 | return name; |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 | * @return the namespace URI for the element, or the empty string for the default namespace | |
| 50 | */ | |
| 51 | public String getNamespaceURI() | |
| 52 | { | |
| 53 | 2224 | return namespaceURI; |
| 54 | } | |
| 55 | ||
| 56 | @Override | |
| 57 | public String toString() | |
| 58 | { | |
| 59 | 0 | StringBuilder builder = new StringBuilder("Start["); |
| 60 | ||
| 61 | 0 | if (namespaceURI != null && namespaceURI.length() > 0) builder.append(namespaceURI).append(" "); |
| 62 | ||
| 63 | 0 | builder.append(name).append("]"); |
| 64 | ||
| 65 | 0 | return builder.toString(); |
| 66 | } | |
| 67 | } |