1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.commons.ognl.test.objects;
21
22 import java.util.*;
23
24 public class Indexed
25 extends BaseIndexed
26 {
27 private String[] _values = new String[] { "foo", "bar", "baz" };
28
29 private List _list = new ArrayList();
30
31 private ListSource _source = new ListSourceImpl();
32
33 private Map _props = new HashMap();
34
35 public Indexed()
36 {
37 _list.add( new Integer( 1 ) );
38 _list.add( new Integer( 2 ) );
39 _list.add( new Integer( 3 ) );
40
41 _source.addValue( new Bean2() );
42 }
43
44 public Indexed( String[] values )
45 {
46 _values = values;
47 }
48
49
50 public String[] getValues()
51 {
52 return _values;
53 }
54
55 public void setValues( String[] value )
56 {
57 _values = value;
58 }
59
60
61
62
63
64 public String getValues( int index )
65 {
66 return _values[index] + "xxx";
67 }
68
69 public void setValues( int index, String value )
70 {
71 if ( value.endsWith( "xxx" ) )
72 {
73 _values[index] = value.substring( 0, value.length() - 3 );
74 }
75 else
76 {
77 _values[index] = value;
78 }
79 }
80
81 public Collection getList()
82 {
83 return _list;
84 }
85
86 public String getTitle( int count )
87 {
88 return "Title count " + count;
89 }
90
91 public ListSource getSource()
92 {
93 return _source;
94 }
95
96 public void setProperty( String property, Object value )
97 {
98 _props.put( property, value );
99 }
100
101 public Object getProperty( String property )
102 {
103 return _props.get( property );
104 }
105 }