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. A 021 * {@link org.apache.tapestry.engine.IComponentClassEnhancer}uses this information to create a 022 * subclass with the necessary instance variables and methods. 023 * 024 * @author Howard Lewis Ship 025 * @since 3.0 026 */ 027 028 public class PropertySpecification extends BaseLocatable implements IPropertySpecification 029 { 030 private String _name; 031 032 private String _type; 033 034 private String _initialValue; 035 036 private String _persistence; 037 038 public String getInitialValue() 039 { 040 return _initialValue; 041 } 042 043 public String getName() 044 { 045 return _name; 046 } 047 048 public boolean isPersistent() 049 { 050 return _persistence != null; 051 } 052 053 /** 054 * The type of property to create, or null if no type was specified. The value is the name of a 055 * primitive type, a fully qualified class name, or an array name for either. Type is only 056 * specified for 3.0 DTDs, in 4.0 the only behavior is for the new property to match the type 057 * defined by an abstract accessor, or to be java.lang.Object. 058 */ 059 public String getType() 060 { 061 return _type; 062 } 063 064 public void setInitialValue(String initialValue) 065 { 066 _initialValue = initialValue; 067 } 068 069 /** 070 * Sets the name of the property. This should not be changed once this IPropertySpecification is 071 * added to a {@link org.apache.tapestry.spec.ComponentSpecification}. 072 */ 073 074 public void setName(String name) 075 { 076 _name = name; 077 } 078 079 public void setType(String type) 080 { 081 _type = type; 082 } 083 084 /** @since 4.0 */ 085 public String getPersistence() 086 { 087 return _persistence; 088 } 089 090 /** @since 4.0 */ 091 public void setPersistence(String persistence) 092 { 093 _persistence = persistence; 094 } 095 }