|
|||||||||||||||||||
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 | |||||||||||||||
ParameterSpecification.java | - | 100% | 100% | 100% |
|
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 formal parameter to a component. A <code>IParameterSpecification</code> is contained
|
|
21 |
* by a {@link IComponentSpecification}.
|
|
22 |
* <p>
|
|
23 |
* TBD: Identify arrays in some way.
|
|
24 |
*
|
|
25 |
* @author Howard Lewis Ship
|
|
26 |
*/
|
|
27 |
|
|
28 |
public class ParameterSpecification extends BaseLocatable implements IParameterSpecification |
|
29 |
{ |
|
30 |
private boolean _required = false; |
|
31 |
|
|
32 |
private String _type;
|
|
33 |
|
|
34 |
/** @since 1.0.9 */
|
|
35 |
private String _description;
|
|
36 |
|
|
37 |
/** @since 2.0.3 */
|
|
38 |
private String _propertyName;
|
|
39 |
|
|
40 |
/** @since 3.0 */
|
|
41 |
private String _defaultValue;
|
|
42 |
|
|
43 |
/** @since 4.0 */
|
|
44 |
private String _defaultBindingType;
|
|
45 |
|
|
46 |
/** @since 4.0 */
|
|
47 |
private boolean _cache = true; |
|
48 |
|
|
49 |
/**
|
|
50 |
* Returns the class name of the expected type of the parameter. The default value is
|
|
51 |
* <code>java.lang.Object</code> which matches anything.
|
|
52 |
*/
|
|
53 |
|
|
54 | 1132 |
public String getType()
|
55 |
{ |
|
56 | 1132 |
return _type;
|
57 |
} |
|
58 |
|
|
59 |
/**
|
|
60 |
* Returns true if the parameter is required by the component. The default is false, meaning the
|
|
61 |
* parameter is optional.
|
|
62 |
*/
|
|
63 |
|
|
64 | 3688 |
public boolean isRequired() |
65 |
{ |
|
66 | 3688 |
return _required;
|
67 |
} |
|
68 |
|
|
69 | 1139 |
public void setRequired(boolean value) |
70 |
{ |
|
71 | 1139 |
_required = value; |
72 |
} |
|
73 |
|
|
74 |
/**
|
|
75 |
* Sets the type of value expected for the parameter. This can be left blank to indicate any
|
|
76 |
* type.
|
|
77 |
*/
|
|
78 |
|
|
79 | 42 |
public void setType(String value) |
80 |
{ |
|
81 | 42 |
_type = value; |
82 |
} |
|
83 |
|
|
84 |
/**
|
|
85 |
* Returns the documentation for this parameter.
|
|
86 |
*
|
|
87 |
* @since 1.0.9
|
|
88 |
*/
|
|
89 |
|
|
90 | 1 |
public String getDescription()
|
91 |
{ |
|
92 | 1 |
return _description;
|
93 |
} |
|
94 |
|
|
95 |
/**
|
|
96 |
* Sets the documentation for this parameter.
|
|
97 |
*
|
|
98 |
* @since 1.0.9
|
|
99 |
*/
|
|
100 |
|
|
101 | 795 |
public void setDescription(String description) |
102 |
{ |
|
103 | 795 |
_description = description; |
104 |
} |
|
105 |
|
|
106 |
/**
|
|
107 |
* Sets the property name (of the component class) to connect the parameter to.
|
|
108 |
*/
|
|
109 |
|
|
110 | 1142 |
public void setPropertyName(String propertyName) |
111 |
{ |
|
112 | 1142 |
_propertyName = propertyName; |
113 |
} |
|
114 |
|
|
115 |
/**
|
|
116 |
* Returns the name of the JavaBeans property to connect the parameter to.
|
|
117 |
*/
|
|
118 |
|
|
119 | 1133 |
public String getPropertyName()
|
120 |
{ |
|
121 | 1133 |
return _propertyName;
|
122 |
} |
|
123 |
|
|
124 |
/**
|
|
125 |
* @see org.apache.tapestry.spec.IParameterSpecification#getDefaultValue()
|
|
126 |
*/
|
|
127 | 3289 |
public String getDefaultValue()
|
128 |
{ |
|
129 | 3289 |
return _defaultValue;
|
130 |
} |
|
131 |
|
|
132 |
/**
|
|
133 |
* @see org.apache.tapestry.spec.IParameterSpecification#setDefaultValue(java.lang.String)
|
|
134 |
*/
|
|
135 | 1139 |
public void setDefaultValue(String defaultValue) |
136 |
{ |
|
137 | 1139 |
_defaultValue = defaultValue; |
138 |
} |
|
139 |
|
|
140 |
/** @since 4.0 */
|
|
141 | 1563 |
public String getDefaultBindingType()
|
142 |
{ |
|
143 | 1563 |
return _defaultBindingType;
|
144 |
} |
|
145 |
|
|
146 |
/** @since 4.0 */
|
|
147 | 1139 |
public void setDefaultBindingType(String defaultBindingType) |
148 |
{ |
|
149 | 1139 |
_defaultBindingType = defaultBindingType; |
150 |
} |
|
151 |
|
|
152 |
/** @since 4.0 */
|
|
153 | 1133 |
public boolean getCache() |
154 |
{ |
|
155 | 1133 |
return _cache;
|
156 |
} |
|
157 |
|
|
158 |
/** @since 4.0 */
|
|
159 | 1139 |
public void setCache(boolean cache) |
160 |
{ |
|
161 | 1139 |
_cache = cache; |
162 |
} |
|
163 |
} |
|