001 // Copyright 2004, 2005 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.tapestry.spec;
016
017 import org.apache.hivemind.impl.BaseLocatable;
018
019 /**
020 * Defines a transient or persistant property of a component or page.
021 *
022 * @author Howard Lewis Ship
023 * @since 3.0
024 */
025
026 public class PropertySpecification extends BaseLocatable implements
027 IPropertySpecification
028 {
029
030 private String _name;
031
032 private String _type;
033
034 private boolean _isGeneric;
035
036 private String _initialValue;
037
038 private String _persistence;
039
040 private boolean _proxyChecked;
041
042 private boolean _canProxy;
043
044 public String getInitialValue()
045 {
046 return _initialValue;
047 }
048
049 public String getName()
050 {
051 return _name;
052 }
053
054 public boolean isPersistent()
055 {
056 return _persistence != null;
057 }
058
059 /**
060 * The type of property to create, or null if no type was specified. The
061 * value is the name of a primitive type, a fully qualified class name, or
062 * an array name for either. Type is only specified for 3.0 DTDs, in 4.0 the
063 * only behavior is for the new property to match the type defined by an
064 * abstract accessor, or to be java.lang.Object.
065 */
066 public String getType()
067 {
068 return _type;
069 }
070
071 public void setInitialValue(String initialValue)
072 {
073 _initialValue = initialValue;
074 }
075
076 /**
077 * Sets the name of the property. This should not be changed once this
078 * IPropertySpecification is added to a
079 * {@link org.apache.tapestry.spec.ComponentSpecification}.
080 */
081
082 public void setName(String name)
083 {
084 _name = name;
085 }
086
087 public void setType(String type)
088 {
089 _type = type;
090 }
091
092 public void setGeneric(boolean isGeneric)
093 {
094 _isGeneric = isGeneric;
095 }
096
097 public boolean isGeneric()
098 {
099 return _isGeneric;
100 }
101
102 /** @since 4.0 */
103 public String getPersistence()
104 {
105 return _persistence;
106 }
107
108 /** @since 4.0 */
109 public void setPersistence(String persistence)
110 {
111 _persistence = persistence;
112 }
113
114 /**
115 * {@inheritDoc}
116 */
117 public boolean canProxy()
118 {
119 return _canProxy;
120 }
121
122 /**
123 * {@inheritDoc}
124 */
125 public boolean isProxyChecked()
126 {
127 return _proxyChecked;
128 }
129
130 /**
131 * {@inheritDoc}
132 */
133 public void setCanProxy(boolean canProxy)
134 {
135 _canProxy = canProxy;
136 }
137
138 /**
139 * {@inheritDoc}
140 */
141 public void setProxyChecked(boolean checked)
142 {
143 _proxyChecked = checked;
144 }
145 }