Annotation Type EmptyIfOtherHasValue


  • @Documented
    @Constraint(validatedBy=EmptyIfOtherHasValueValidator.class)
    @Target({TYPE,ANNOTATION_TYPE})
    @Retention(RUNTIME)
    public @interface EmptyIfOtherHasValue
    The annotated bean must contain at least two properties:
    • a field that has to be checked (option field)
    • a field which entry is compared against a value (option fieldCompare and valueCompare)
    if the entry of fieldCompare matches valueCompare, field must be empty (null or "").
    Supported types are beans, null elements are considered valid.
    Author:
    Manfred Tremmel
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<?>[] groups
      groups to use.
      String message
      localized message.
      Class<? extends javax.validation.Payload>[] payload
      payload whatever.
    • Element Detail

      • field

        String field
        field name to check.
        Returns:
        field/path of the value
      • fieldCompare

        String fieldCompare
        field name to compare.
        Returns:
        field/path of the value to compare
      • valueCompare

        String[] valueCompare
        value to compare with field name to compare.
        Returns:
        value to compare
      • message

        String message
        localized message.
        Returns:
        localized validation message
        Default:
        "{de.knightsoftnet.validators.shared.EmptyIfOtherHasValue.message}"
      • groups

        Class<?>[] groups
        groups to use.
        Returns:
        array of validation groups
        Default:
        {}
      • payload

        Class<? extends javax.validation.Payload>[] payload
        payload whatever.
        Returns:
        payload class
        Default:
        {}