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    *      https://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      public class Cheezy {
31          public Iterator<String> iterator() {
32              return getCheeseList().iterator();
33          }
34      }
35      private boolean beenModified;
36      private String property1 = "some value";
37  
38      public String bar()
39      {
40          return ExpressionsTest.METHOD_STRING;
41      }
42  
43      public String convertBoolean(final boolean b)
44      {
45          return "Boolean : " + b;
46      }
47  
48      public String[] getArray()
49      {
50          return ArrayAccessTest.GET_METHOD_ARRAY;
51      }
52  
53      public String[][] getArray2()
54      {
55          return ArrayAccessTest.GET_METHOD_ARRAY2;
56      }
57  
58      public String getBar()
59      {
60          return ExpressionsTest.GET_METHOD_STRING;
61      }
62  
63      public List<String> getCheeseList()
64      {
65          final ArrayList<String> answer = new ArrayList<>();
66          answer.add("cheddar");
67          answer.add("edam");
68          answer.add("brie");
69          return answer;
70      }
71  
72      public Cheezy getCheezy()
73      {
74          return new Cheezy();
75      }
76  
77      public int getCount() {
78          return 5;
79      }
80  
81      public Foo getInnerFoo()
82      {
83          return new Foo();
84      }
85  
86      public boolean getModified()
87      {
88          return beenModified;
89      }
90  
91      public String getProperty1() {
92          return property1;
93      }
94  
95      public String getQuux() {
96          return "String : quux";
97      }
98  
99      public int getSize()
100     {
101         return 22;
102     }
103 
104     public boolean getTrueAndModify()
105     {
106         beenModified = true;
107         return true;
108     }
109 
110     public boolean isSimple()
111     {
112         return true;
113     }
114 
115     public String repeat(final String str) {
116         return "Repeat : " + str;
117     }
118 
119     public void setProperty1(final String newValue) {
120         property1 = newValue;
121     }
122 
123     public int square(final int value)
124     {
125         return value * value;
126     }
127 }