Annotation Type NotEmptyIfOthersHaveValue


  • @Constraint(validatedBy=NotEmptyIfOthersHaveValueValidator.class)
    @Target({TYPE,ANNOTATION_TYPE})
    @Retention(RUNTIME)
    public @interface NotEmptyIfOthersHaveValue
    The annotated bean must contain at least two properties:
    • a field that has to be checked (option field)
    • a array of fields and entries to be compared (option otherFieldValueMapping)
    if the entries of otherFieldValueMapping.fieldCompare matches one of the corresponding entries in otherFieldValueMapping.valueCompare (array of possible values), field must not be empty (null or "").
    Supported types are beans, null elements are considered valid.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<?>[] groups
      validation groups.
      String message
      validation message.
      double minValue
      optional minimum value that the field should have.
      Class<? extends javax.validation.Payload>[] payload
      payload classes.
    • Element Detail

      • field

        String field
        name of the field to be validated.
        Returns:
        the name of the field to be validated
      • otherFieldValueMapping

        FieldValueMapping[] otherFieldValueMapping
        array of FieldValueMapping's.
        Returns:
        an array of FieldValueMapping's
      • message

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

        Class<?>[] groups
        validation groups.
        Returns:
        the validation groups
        Default:
        {}
      • minValue

        double minValue
        optional minimum value that the field should have.
        Returns:
        the minimum value that the field should have, -Double.MAX_VALUE if not specified.
        Default:
        -1.7976931348623157E308
      • payload

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