net.sf.beanlib.provider
Class BeanChecker

java.lang.Object
  extended by net.sf.beanlib.provider.BeanChecker

public class BeanChecker
extends Object

Bean Checker.

Author:
Joe D. Velopar

Field Summary
static BeanChecker inst
          Singleton instance.
private  Log log
           
 
Constructor Summary
private BeanChecker()
          Singleton.
 
Method Summary
 boolean beanEquals(Object fBean, Object tBean)
           
 boolean empty(Object fromBean, Class k)
          Returns true if the fromBean is empty; or false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inst

public static final BeanChecker inst
Singleton instance.


log

private final Log log
Constructor Detail

BeanChecker

private BeanChecker()
Singleton.

Method Detail

empty

public boolean empty(Object fromBean,
                     Class k)
Returns true if the fromBean is empty; or false otherwise. It is considered empty if every publicly declared getter methods of the specified class either return null or blank string.

Parameters:
fromBean - java bean to check if empty or not.
k - specified class name from which the getter methods are derived.

beanEquals

public boolean beanEquals(Object fBean,
                          Object tBean)
Parameters:
fBean - from bean
tBean - to bean
Returns:
true if the two beans are equal in a JavaBean sense. ie. if they have the same number of properties, and the properties that can be read contain the same values. TODO: unit test me