View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.jexl3;
18  
19  import java.util.ArrayList;
20  import java.util.Iterator;
21  import java.util.List;
22  
23  /**
24   * A simple bean used for testing purposes
25   *
26   * @since 1.0
27   */
28  public class Foo {
29  
30      private boolean beenModified = false;
31      private String property1 = "some value";
32      public Foo() {}
33      public class Cheezy {
34          public Iterator<String> iterator() {
35              return getCheeseList().iterator();
36          }
37      }
38  
39      public String bar()
40      {
41          return JexlTest.METHOD_STRING;
42      }
43  
44      public String getBar()
45      {
46          return JexlTest.GET_METHOD_STRING;
47      }
48  
49      public Foo getInnerFoo()
50      {
51          return new Foo();
52      }
53  
54      public String getQuux() {
55          return "String : quux";
56      }
57  
58      public String repeat(final String str) {
59          return "Repeat : " + str;
60      }
61  
62      public String convertBoolean(final boolean b)
63      {
64          return "Boolean : " + b;
65      }
66  
67      public int getCount() {
68          return 5;
69      }
70  
71      public List<String> getCheeseList()
72      {
73          final ArrayList<String> answer = new ArrayList<>();
74          answer.add("cheddar");
75          answer.add("edam");
76          answer.add("brie");
77          return answer;
78      }
79  
80      public Cheezy getCheezy()
81      {
82          return new Cheezy();
83      }
84  
85      public String[] getArray()
86      {
87          return ArrayAccessTest.GET_METHOD_ARRAY;
88      }
89  
90      public String[][] getArray2()
91      {
92          return ArrayAccessTest.GET_METHOD_ARRAY2;
93      }
94  
95      public boolean isSimple()
96      {
97          return true;
98      }
99  
100     public int square(final int value)
101     {
102         return value * value;
103     }
104 
105     public boolean getTrueAndModify()
106     {
107         beenModified = true;
108         return true;
109     }
110 
111     public boolean getModified()
112     {
113         return beenModified;
114     }
115 
116 
117     public int getSize()
118     {
119         return 22;
120     }
121 
122     public String getProperty1() {
123         return property1;
124     }
125 
126     public void setProperty1(final String newValue) {
127         property1 = newValue;
128     }
129 }