java.lang.Object
org.apache.logging.log4j.core.config.plugins.validation.validators.ValidPortValidator
All Implemented Interfaces:
ConstraintValidator<ValidPort>

public class ValidPortValidator extends Object implements ConstraintValidator<ValidPort>
Validator that checks an object to verify it is a valid port number (an integer between 0 and 65535).
Since:
2.8
  • Constructor Details

    • ValidPortValidator

      public ValidPortValidator()
  • Method Details

    • initialize

      public void initialize(ValidPort annotation)
      Description copied from interface: ConstraintValidator
      Called before this validator is used with the constraint annotation value.
      Specified by:
      initialize in interface ConstraintValidator<ValidPort>
      Parameters:
      annotation - the annotation value this validator will be validating.
    • isValid

      public boolean isValid(String name, Object value)
      Description copied from interface: ConstraintValidator
      Indicates if the given value is valid.
      Specified by:
      isValid in interface ConstraintValidator<ValidPort>
      Parameters:
      name - the name to use for error reporting
      value - the value to validate.
      Returns:
      true if the given value is valid.