A - The type of the beans to be compared by the comparator interface.public interface BeanComparator<A>
You can define comparators by extending this interface.
Imagine you have the following java bean class defined as:
public class Person {
private String name;
private int age;
public String getName(){return name;}
public void setName(String name){this.name = name;}
public int getAge(){return age;}
public void setAge(int age){this.age = age;}
}
You can define the following interface to make comparation between two objects of the given class, considering its property values:
public interface PersonComparator extends BeanComparator{}
To use the comparator, just call GWT.create on the given interface, or inject it on your class.
public class MyController {
@Inject
private PersonComparator comparator;
@Expose
public void myMethod() {
// read two objects...
if(comparator.equals(person1, person2)) {
// ...
}
}
}
Copyright © 2015. All rights reserved.