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