001    /*
002     * $Id: Bean3.java 1188000 2011-10-23 23:10:24Z mcucchiara $
003     * Licensed to the Apache Software Foundation (ASF) under one
004     * or more contributor license agreements.  See the NOTICE file
005     * distributed with this work for additional information
006     * regarding copyright ownership.  The ASF licenses this file
007     * to you under the Apache License, Version 2.0 (the
008     * "License"); you may not use this file except in compliance
009     * with the License.  You may obtain a copy of the License at
010     *
011     * http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing,
014     * software distributed under the License is distributed on an
015     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     * KIND, either express or implied.  See the License for the
017     * specific language governing permissions and limitations
018     * under the License.
019     */
020    package org.apache.commons.ognl.test.objects;
021    
022    import java.util.HashMap;
023    import java.util.Map;
024    
025    public class Bean3
026    {
027        private int value = 100;
028    
029        private Map map;
030        {
031            map = new HashMap();
032            map.put( "foo", "bar" );
033            map.put( "bar", "baz" );
034        }
035    
036        private String _nullValue;
037    
038        private Object _indexValue;
039    
040        public int getValue()
041        {
042            return value;
043        }
044    
045        public void setValue( int value )
046        {
047            this.value = value;
048        }
049    
050        public Object getIndexedValue( int index )
051        {
052            return _indexValue;
053        }
054    
055        public void setIndexedValue( int index, Object value )
056        {
057            _indexValue = value;
058        }
059    
060        public Map getMap()
061        {
062            return map;
063        }
064    
065        public void setNullValue( String value )
066        {
067            _nullValue = value;
068        }
069    
070        public String getNullValue()
071        {
072            return _nullValue;
073        }
074    
075        /*
076         * (non-Javadoc)
077         * @see java.lang.Object#hashCode()
078         */
079        public int hashCode()
080        {
081            final int prime = 31;
082            int result = 1;
083            result = prime * result + ( ( _indexValue == null ) ? 0 : _indexValue.hashCode() );
084            return result;
085        }
086    
087        /*
088         * (non-Javadoc)
089         * @see java.lang.Object#equals(java.lang.Object)
090         */
091        public boolean equals( Object obj )
092        {
093            if ( this == obj )
094                return true;
095            if ( obj == null )
096                return false;
097            if ( getClass() != obj.getClass() )
098                return false;
099            final Bean3 other = (Bean3) obj;
100            if ( _indexValue == null )
101            {
102                if ( other._indexValue != null )
103                    return false;
104            }
105            else if ( !_indexValue.equals( other._indexValue ) )
106                return false;
107            return true;
108        }
109    }