|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LocalizationToken.java | - | 88.9% | 80% | 85.7% |
|
1 |
// Copyright 2004, 2005 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.tapestry.parse;
|
|
16 |
|
|
17 |
import java.util.Map;
|
|
18 |
|
|
19 |
import org.apache.hivemind.Location;
|
|
20 |
|
|
21 |
/**
|
|
22 |
* Represents localized text from the template.
|
|
23 |
*
|
|
24 |
* @see TokenType#LOCALIZATION
|
|
25 |
*
|
|
26 |
* @author Howard Lewis Ship
|
|
27 |
* @since 3.0
|
|
28 |
*
|
|
29 |
**/
|
|
30 |
|
|
31 |
public class LocalizationToken extends TemplateToken |
|
32 |
{ |
|
33 |
private String _tag;
|
|
34 |
private String _key;
|
|
35 |
private boolean _raw; |
|
36 |
private Map _attributes;
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Creates a new token.
|
|
40 |
*
|
|
41 |
*
|
|
42 |
* @param tag the tag of the element from the template
|
|
43 |
* @param key the localization key specified
|
|
44 |
* @param raw if true, then the localized value contains markup that should not be escaped
|
|
45 |
* @param attributes any additional attributes (beyond those used to define key and raw)
|
|
46 |
* that were specified. This value is retained, not copied.
|
|
47 |
* @param location location of the tag which defines this token
|
|
48 |
*
|
|
49 |
**/
|
|
50 |
|
|
51 | 15 |
public LocalizationToken(String tag, String key, boolean raw, Map attributes, Location location) |
52 |
{ |
|
53 | 15 |
super(TokenType.LOCALIZATION, location);
|
54 |
|
|
55 | 15 |
_tag = tag; |
56 | 15 |
_key = key; |
57 | 15 |
_raw = raw; |
58 | 15 |
_attributes = attributes; |
59 |
} |
|
60 |
|
|
61 |
/**
|
|
62 |
* Returns any attributes for the token, which may be null. Do not modify
|
|
63 |
* the return value.
|
|
64 |
*
|
|
65 |
**/
|
|
66 |
|
|
67 | 17 |
public Map getAttributes()
|
68 |
{ |
|
69 | 17 |
return _attributes;
|
70 |
} |
|
71 |
|
|
72 | 14 |
public boolean isRaw() |
73 |
{ |
|
74 | 14 |
return _raw;
|
75 |
} |
|
76 |
|
|
77 | 0 |
public String getTag()
|
78 |
{ |
|
79 | 0 |
return _tag;
|
80 |
} |
|
81 |
|
|
82 | 17 |
public String getKey()
|
83 |
{ |
|
84 | 17 |
return _key;
|
85 |
} |
|
86 |
} |
|
87 |
|
|