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