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 package org.apache.tapestry.record; 015 016 import java.io.Serializable; 017 import java.util.Date; 018 import java.util.HashMap; 019 import java.util.Map; 020 021 import org.apache.commons.lang.builder.ToStringBuilder; 022 import org.apache.commons.lang.builder.ToStringStyle; 023 024 025 /** 026 * Simple object used for testing object property changes. 027 */ 028 public class SimpleState implements Serializable 029 { 030 /** serialVersionUID */ 031 private static final long serialVersionUID = 8466422593705479396L; 032 033 long _id; 034 String _name; 035 boolean _isValid; 036 Date _date; 037 Map _keys = new HashMap(); 038 039 public SimpleState() {} 040 041 public SimpleState(long id, String name) 042 { 043 _id = id; 044 _name = name; 045 } 046 047 public long getId() 048 { 049 return _id; 050 } 051 052 public void setId(long id) 053 { 054 _id = id; 055 } 056 057 /** 058 * @return Returns the name. 059 */ 060 public String getName() 061 { 062 return _name; 063 } 064 065 /** 066 * @param name The name to set. 067 */ 068 public void setName(String name) 069 { 070 _name = name; 071 } 072 073 /** 074 * @return Returns the isValid. 075 */ 076 public boolean isValid() 077 { 078 return _isValid; 079 } 080 081 /** 082 * @param isValid The isValid to set. 083 */ 084 public void setValid(boolean isValid) 085 { 086 _isValid = isValid; 087 } 088 089 /** 090 * @return Returns the date. 091 */ 092 public Date getDate() 093 { 094 return _date; 095 } 096 097 /** 098 * @param date The date to set. 099 */ 100 public void setDate(Date date) 101 { 102 _date = date; 103 } 104 105 public Map getKeys() 106 { 107 return _keys; 108 } 109 110 public String toString() 111 { 112 return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) 113 .append("id", _id) 114 .append("name", _name) 115 .append("isValid", _isValid) 116 .append("date", _date) 117 .toString(); 118 } 119 }