org.springmodules.validation.util.condition.bean
Class EqualPropertiesBeanCondition
java.lang.Object
org.springmodules.validation.util.condition.AbstractCondition
org.springmodules.validation.util.condition.NonNullAcceptingCondition
org.springmodules.validation.util.condition.bean.AbstractBeanCondition
org.springmodules.validation.util.condition.bean.EqualPropertiesBeanCondition
- All Implemented Interfaces:
- Condition
public class EqualPropertiesBeanCondition
- extends AbstractBeanCondition
An AbstractBeanCondition
implementation that checks whether specific properties of the checked bean
have the same value.
- Author:
- Uri Boness
Method Summary |
protected boolean |
checkBean(BeanWrapper bean)
Checks whether a set of properties of the given bean have the same value. |
String[] |
getPropertyNames()
Returns the property names associated with this condition. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EqualPropertiesBeanCondition
public EqualPropertiesBeanCondition(String[] propertyNames)
- Constructs a new EqualPropertiesBeanCondition with a given list of names of the properties to be compared.
- Parameters:
propertyNames
- The name of the properties to be compared.
- Throws:
IllegalArgumentException
- when the given property names array contains zero or one names.
EqualPropertiesBeanCondition
public EqualPropertiesBeanCondition(String property1,
String property2)
- Constructs a new EqualPropertiesBeanCondition with two given names of the properties to be compared.
- Parameters:
property1
- The name of the first property.property2
- The name of the second property.
checkBean
protected boolean checkBean(BeanWrapper bean)
- Checks whether a set of properties of the given bean have the same value. The properties are resolved based on
the property names associated with this condition.
- Specified by:
checkBean
in class AbstractBeanCondition
- Parameters:
bean
- The bean to be checked.
- Returns:
true
if all the compared properties are equal, false
otherwise.
getPropertyNames
public String[] getPropertyNames()
- Returns the property names associated with this condition.
- Returns:
- The property names associated with this condition.
Copyright © 2009. All Rights Reserved.