Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
PropertySpecification |
|
| 1.0;1 |
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.spec; |
|
16 | ||
17 | import org.apache.hivemind.impl.BaseLocatable; |
|
18 | ||
19 | /** |
|
20 | * Defines a transient or persistant property of a component or page. |
|
21 | * |
|
22 | * @author Howard Lewis Ship |
|
23 | * @since 3.0 |
|
24 | */ |
|
25 | ||
26 | 12 | public class PropertySpecification extends BaseLocatable implements |
27 | IPropertySpecification |
|
28 | { |
|
29 | ||
30 | private String _name; |
|
31 | ||
32 | private String _type; |
|
33 | ||
34 | private boolean _isGeneric; |
|
35 | ||
36 | private String _initialValue; |
|
37 | ||
38 | private String _persistence; |
|
39 | ||
40 | private boolean _proxyChecked; |
|
41 | ||
42 | private boolean _canProxy; |
|
43 | ||
44 | public String getInitialValue() |
|
45 | { |
|
46 | 20 | return _initialValue; |
47 | } |
|
48 | ||
49 | public String getName() |
|
50 | { |
|
51 | 26 | return _name; |
52 | } |
|
53 | ||
54 | public boolean isPersistent() |
|
55 | { |
|
56 | 10 | return _persistence != null; |
57 | } |
|
58 | ||
59 | /** |
|
60 | * The type of property to create, or null if no type was specified. The |
|
61 | * value is the name of a primitive type, a fully qualified class name, or |
|
62 | * an array name for either. Type is only specified for 3.0 DTDs, in 4.0 the |
|
63 | * only behavior is for the new property to match the type defined by an |
|
64 | * abstract accessor, or to be java.lang.Object. |
|
65 | */ |
|
66 | public String getType() |
|
67 | { |
|
68 | 8 | return _type; |
69 | } |
|
70 | ||
71 | public void setInitialValue(String initialValue) |
|
72 | { |
|
73 | 20 | _initialValue = initialValue; |
74 | 20 | } |
75 | ||
76 | /** |
|
77 | * Sets the name of the property. This should not be changed once this |
|
78 | * IPropertySpecification is added to a |
|
79 | * {@link org.apache.tapestry.spec.ComponentSpecification}. |
|
80 | */ |
|
81 | ||
82 | public void setName(String name) |
|
83 | { |
|
84 | 12 | _name = name; |
85 | 12 | } |
86 | ||
87 | public void setType(String type) |
|
88 | { |
|
89 | 5 | _type = type; |
90 | 5 | } |
91 | ||
92 | public void setGeneric(boolean isGeneric) |
|
93 | { |
|
94 | 0 | _isGeneric = isGeneric; |
95 | 0 | } |
96 | ||
97 | public boolean isGeneric() |
|
98 | { |
|
99 | 4 | return _isGeneric; |
100 | } |
|
101 | ||
102 | /** @since 4.0 */ |
|
103 | public String getPersistence() |
|
104 | { |
|
105 | 0 | return _persistence; |
106 | } |
|
107 | ||
108 | /** @since 4.0 */ |
|
109 | public void setPersistence(String persistence) |
|
110 | { |
|
111 | 12 | _persistence = persistence; |
112 | 12 | } |
113 | ||
114 | /** |
|
115 | * {@inheritDoc} |
|
116 | */ |
|
117 | public boolean canProxy() |
|
118 | { |
|
119 | 0 | return _canProxy; |
120 | } |
|
121 | ||
122 | /** |
|
123 | * {@inheritDoc} |
|
124 | */ |
|
125 | public boolean isProxyChecked() |
|
126 | { |
|
127 | 0 | return _proxyChecked; |
128 | } |
|
129 | ||
130 | /** |
|
131 | * {@inheritDoc} |
|
132 | */ |
|
133 | public void setCanProxy(boolean canProxy) |
|
134 | { |
|
135 | 0 | _canProxy = canProxy; |
136 | 0 | } |
137 | ||
138 | /** |
|
139 | * {@inheritDoc} |
|
140 | */ |
|
141 | public void setProxyChecked(boolean checked) |
|
142 | { |
|
143 | 0 | _proxyChecked = checked; |
144 | 0 | } |
145 | } |