1 /*
2 * $Id: Bean3.java 1188000 2011-10-23 23:10:24Z mcucchiara $
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 */
20 package org.apache.commons.ognl.test.objects;
21
22 import java.util.HashMap;
23 import java.util.Map;
24
25 public class Bean3
26 {
27 private int value = 100;
28
29 private Map map;
30 {
31 map = new HashMap();
32 map.put( "foo", "bar" );
33 map.put( "bar", "baz" );
34 }
35
36 private String _nullValue;
37
38 private Object _indexValue;
39
40 public int getValue()
41 {
42 return value;
43 }
44
45 public void setValue( int value )
46 {
47 this.value = value;
48 }
49
50 public Object getIndexedValue( int index )
51 {
52 return _indexValue;
53 }
54
55 public void setIndexedValue( int index, Object value )
56 {
57 _indexValue = value;
58 }
59
60 public Map getMap()
61 {
62 return map;
63 }
64
65 public void setNullValue( String value )
66 {
67 _nullValue = value;
68 }
69
70 public String getNullValue()
71 {
72 return _nullValue;
73 }
74
75 /*
76 * (non-Javadoc)
77 * @see java.lang.Object#hashCode()
78 */
79 public int hashCode()
80 {
81 final int prime = 31;
82 int result = 1;
83 result = prime * result + ( ( _indexValue == null ) ? 0 : _indexValue.hashCode() );
84 return result;
85 }
86
87 /*
88 * (non-Javadoc)
89 * @see java.lang.Object#equals(java.lang.Object)
90 */
91 public boolean equals( Object obj )
92 {
93 if ( this == obj )
94 return true;
95 if ( obj == null )
96 return false;
97 if ( getClass() != obj.getClass() )
98 return false;
99 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 }