|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A - The type of the beans to be validated by the validator interface.public interface BeanContentValidator<A>
An utility interface to allow content validation on objects.
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)) {
// ...
}
}
}
| Method Summary | |
|---|---|
boolean |
isEmpty(A a)
Check if the given object has all of their properties empty |
boolean |
isFilled(A a)
Check if the given object has all of their properties filled |
| Method Detail |
|---|
boolean isEmpty(A a)
a - the object to check
boolean isFilled(A a)
a - the object to check
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||