|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| PropertySpecification.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 transient or persistant property of a component or page. A | |
| 21 | * {@link org.apache.tapestry.engine.IComponentClassEnhancer}uses this information to create a | |
| 22 | * subclass with the necessary instance variables and methods. | |
| 23 | * | |
| 24 | * @author Howard Lewis Ship | |
| 25 | * @since 3.0 | |
| 26 | */ | |
| 27 | ||
| 28 | public class PropertySpecification extends BaseLocatable implements IPropertySpecification | |
| 29 | { | |
| 30 | private String _name; | |
| 31 | ||
| 32 | private String _type; | |
| 33 | ||
| 34 | private String _initialValue; | |
| 35 | ||
| 36 | private String _persistence; | |
| 37 | ||
| 38 | 714 | public String getInitialValue() |
| 39 | { | |
| 40 | 714 | return _initialValue; |
| 41 | } | |
| 42 | ||
| 43 | 732 | public String getName() |
| 44 | { | |
| 45 | 732 | return _name; |
| 46 | } | |
| 47 | ||
| 48 | 357 | public boolean isPersistent() |
| 49 | { | |
| 50 | 357 | return _persistence != null; |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * The type of property to create, or null if no type was specified. The value is the name of a | |
| 55 | * primitive type, a fully qualified class name, or an array name for either. Type is only | |
| 56 | * specified for 3.0 DTDs, in 4.0 the only behavior is for the new property to match the type | |
| 57 | * defined by an abstract accessor, or to be java.lang.Object. | |
| 58 | */ | |
| 59 | 351 | public String getType() |
| 60 | { | |
| 61 | 351 | return _type; |
| 62 | } | |
| 63 | ||
| 64 | 714 | public void setInitialValue(String initialValue) |
| 65 | { | |
| 66 | 714 | _initialValue = initialValue; |
| 67 | } | |
| 68 | ||
| 69 | /** | |
| 70 | * Sets the name of the property. This should not be changed once this IPropertySpecification is | |
| 71 | * added to a {@link org.apache.tapestry.spec.ComponentSpecification}. | |
| 72 | */ | |
| 73 | ||
| 74 | 363 | public void setName(String name) |
| 75 | { | |
| 76 | 363 | _name = name; |
| 77 | } | |
| 78 | ||
| 79 | 162 | public void setType(String type) |
| 80 | { | |
| 81 | 162 | _type = type; |
| 82 | } | |
| 83 | ||
| 84 | /** @since 4.0 */ | |
| 85 | 60 | public String getPersistence() |
| 86 | { | |
| 87 | 60 | return _persistence; |
| 88 | } | |
| 89 | ||
| 90 | /** @since 4.0 */ | |
| 91 | 363 | public void setPersistence(String persistence) |
| 92 | { | |
| 93 | 363 | _persistence = persistence; |
| 94 | } | |
| 95 | } |
|
||||||||||