Home | History | Annotate | Download | only in vo
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      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 android.databinding.testapp.vo;
     17 
     18 import android.databinding.BaseObservable;
     19 import android.databinding.Bindable;
     20 import android.databinding.ObservableField;
     21 import android.databinding.testapp.BR;
     22 import android.util.ArrayMap;
     23 
     24 import java.util.ArrayList;
     25 import java.util.List;
     26 import java.util.Map;
     27 
     28 public class FindMethodBindingObject extends FindMethodBindingObjectBase {
     29     public String method() { return "no arg"; }
     30 
     31     public String method(int i) { return String.valueOf(i); }
     32 
     33     public String method(float f) { return String.valueOf(f); }
     34 
     35     public String method(String value) { return value; }
     36 
     37     public static String staticMethod() { return "world"; }
     38 
     39     public static Foo foo = new Foo();
     40 
     41     public ObservableClass observableClass = new ObservableClass();
     42 
     43     public static Bar<String> bar = new Bar<>();
     44 
     45     public float confusingParam(int i) { return i; }
     46     public String confusingParam(Object o) { return o.toString(); }
     47 
     48     public int confusingPrimitive(int i) { return i; }
     49     public String confusingPrimitive(Integer i) { return i.toString(); }
     50 
     51     public float confusingInheritance(Object o) { return 0; }
     52     public String confusingInheritance(String s) { return s; }
     53     public int confusingInheritance(Integer i) { return i; }
     54 
     55     public int confusingTypeArgs(List<String> s) { return 0; }
     56     public String confusingTypeArgs(Map<String, String> s) { return "yay"; }
     57 
     58     public ArrayMap<String, String> getMap() { return null; }
     59 
     60     public int[] getArray() { return new int[5]; }
     61 
     62     public final ObservableField<String> myField = new ObservableField<String>();
     63 
     64     public List getList() {
     65         ArrayList<String> vals = new ArrayList<>();
     66         vals.add("hello");
     67         return vals;
     68     }
     69 
     70     public static class Foo {
     71         public final String bar = "hello world";
     72         public static final String baz = "hello world";
     73     }
     74 
     75     public static class Bar<T> {
     76         public T method(T value) { return value; }
     77     }
     78 
     79     public static final class ObservableClass extends BaseObservable {
     80         public String x;
     81 
     82         public String getX() {
     83             return x;
     84         }
     85 
     86         public void setX(String x) {
     87             this.x = x;
     88             notifyPropertyChanged(BR._all);
     89         }
     90     }
     91 }
     92