org.cruxframework.crux.core.client.bean
Interface BeanContentValidator<A>

Type Parameters:
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)) {
           // ...
       }
    }
 }
 

Author:
Thiago da Rosa de Bustamante

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

isEmpty

boolean isEmpty(A a)
Check if the given object has all of their properties empty

Parameters:
a - the object to check
Returns:
true if the object is empty

isFilled

boolean isFilled(A a)
Check if the given object has all of their properties filled

Parameters:
a - the object to check
Returns:
true if the object is filled


Copyright © 2014. All rights reserved.