|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A - The type of the beans to be compared by the comparator interface.public interface BeanComparator<A>
An utility interface to allow comparation between two objects.
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)) {
// ...
}
}
}
| Method Summary | |
|---|---|
boolean |
equals(A a1,
A a2)
Compare two objects, considering the value of each property, that follow the java bean notation. |
| Method Detail |
|---|
boolean equals(A a1,
A a2)
a1 - object1a2 - object2
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||