0

Apache camel bean validation:

I have one field dependent on another can some one help me how to Validate e.g. If manufacturer field data is SPECIFIC then licensePlate field is mandatory.

<?xml version="1.0" encoding="UTF-8"?>
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
    xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
    <default-package>org.apache.camel.component.bean.validator</default-package>

    <bean class="CarWithoutAnnotations" ignore-annotations="true">
        <field name="manufacturer">
            <constraint annotation="javax.validation.constraints.NotNull" />
        </field>

        <field name="licensePlate">
            <constraint annotation="javax.validation.constraints.NotNull" />

         </field>
    </bean>
</constraint-mappings>
Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65

1 Answers1

1

Please use org.hibernate.validator.constraints.ScriptAssert for cross field validation.