Class CheckMisconfigured
Object
org.anchoranalysis.bean.initializable.CheckMisconfigured
public class CheckMisconfigured extends Object
Routines for checking that particular patterns exist with bean-properties.
They are intended to be used inside an overridden AnchorBean.checkMisconfigured(org.anchoranalysis.bean.BeanInstanceMap) method.
- Author:
- Owen Feehan
-
Method Summary
Modifier and Type Method Description static voidatLeastOne(String property1Name, String property2Name, boolean property1Defined, boolean property2Defined)Checks that one of two properties is defined, or both.static voidoneOnly(String property1Name, String property2Name, boolean property1Defined, boolean property2Defined)Checks that one of two properties is defined, but not both simultaneously.
-
Method Details
-
oneOnly
public static void oneOnly(String property1Name, String property2Name, boolean property1Defined, boolean property2Defined) throws BeanMisconfiguredExceptionChecks that one of two properties is defined, but not both simultaneously.This imposes an exclusive or check.
- Parameters:
property1Name- name of first property (for error messages).property2Name- name of second property (for error messages).property1Defined- whether the first property is defined.property2Defined- whether the second property is defined.- Throws:
BeanMisconfiguredException- if neither or both properties are defined.
-
atLeastOne
public static void atLeastOne(String property1Name, String property2Name, boolean property1Defined, boolean property2Defined) throws BeanMisconfiguredExceptionChecks that one of two properties is defined, or both.This imposes an or check.
- Parameters:
property1Name- name of first property (for error messages).property2Name- name of second property (for error messages).property1Defined- whether the first property is defined.property2Defined- whether the second property is defined.- Throws:
BeanMisconfiguredException- if neither are defined.
-