001    // Copyright Jul 30, 2006 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.dojo.form;
015    
016    
017    /**
018     * Simple bean style class to test {@link DefaultAutocompleteModel}.
019     * 
020     * @author jkuhnert
021     */
022    public class SimpleBean
023    {
024    
025        private Integer _id;
026        
027        private String _label;
028        
029        private int _value;
030        
031        public SimpleBean(Integer id, String label, int value)
032        {
033            _id = id;
034            _label = label;
035            _value = value;
036        }
037        
038        /**
039         * @return the id
040         */
041        public Integer getId()
042        {
043            return _id;
044        }
045        
046        /**
047         * @return the label
048         */
049        public String getLabel()
050        {
051            return _label;
052        }
053        
054        /**
055         * Returns the value stored.
056         * 
057         * @return The value stored.
058         */
059        public int getValue()
060        {
061            return _value;
062        }
063    
064        /** 
065         * {@inheritDoc}
066         */
067        @Override
068        public int hashCode()
069        {
070            final int PRIME = 31;
071            int result = 1;
072            result = PRIME * result + ((_id == null) ? 0 : _id.hashCode());
073            return result;
074        }
075        
076        /** 
077         * {@inheritDoc}
078         */
079        @Override
080        public boolean equals(Object obj)
081        {
082            if (this == obj) return true;
083            if (obj == null) return false;
084            if (getClass() != obj.getClass()) return false;
085            final SimpleBean other = (SimpleBean) obj;
086            if (_id == null) {
087                if (other._id != null) return false;
088            } else if (!_id.equals(other._id)) return false;
089            return true;
090        }
091    }