You can validate properties that are interrelated to ensure that they are consistent. To do this, use the PropertyGatherer
validator, which can gather up named properties in a Map<String, Object>
and then invokes a configured BeanValidator
for inter-property validation. For example, this AllSameValuesValidator
will have its validateBean
method invoked with the pBean
parameter being Map<String, Object>
containing entries for StringOne
and StringTwo
:
<schema id="cross-props"> <bean class="atg.service.configuration.db.TestBean"/> <wrapping-validator-instance class="PropertyGatherer"> <param name="propertiesValidator" value="instance:atg.service.payloadschema. PayloadSchemaRegistryTest$AllSameValuesValidator"/> <param name="propertyNames" value="stringOne,stringTwo"/> </wrapping-validator-instance> <property name="stringOne" required="true"/> <property name="stringTwo" required="true"/> </schema>
The PropertyGatherer
has other properties that can be configured using the param
tag:
Property | Description |
---|---|
| A Boolean property that defaults to |
| A |
| Integer properties that represent the maximum and minimum |
| A |
| A Boolean property that saves multiple values for the same property name when set to |