A - The type of the beans to be validated by the validator interface.public interface BeanContentValidator<A>
You can define content validators 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 check if objects have all of its properties filled or if them are all empty:
public interface PersonValidator extends BeanContentValidator{}
To use the validator, just call GWT.create on the given interface, or inject it on your class.
public class MyController {
@Inject
private PersonValidator validator;
@Expose
public void myMethod() {
// read the object...
if(!validator.isFilled(person)) {
// ...
}
}
}
boolean isEmpty(A a)
a - the object to checkboolean isFilled(A a)
a - the object to checkCopyright © 2015. All rights reserved.