Class ValidHostValidator
- java.lang.Object
-
- org.apache.logging.log4j.core.config.plugins.validation.validators.ValidHostValidator
-
- All Implemented Interfaces:
ConstraintValidator<ValidHost>
public class ValidHostValidator extends Object implements ConstraintValidator<ValidHost>
Validator that checks an object to verify it is a valid hostname or IP address. Validation rules follow the same logic as inInetAddress.getByName(String)
.- Since:
- 2.8
-
-
Constructor Summary
Constructors Constructor Description ValidHostValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
initialize(ValidHost annotation)
Called before this validator is used with the constraint annotation value.boolean
isValid(String name, Object value)
Indicates if the given value is valid.
-
-
-
Method Detail
-
initialize
public void initialize(ValidHost annotation)
Description copied from interface:ConstraintValidator
Called before this validator is used with the constraint annotation value.- Specified by:
initialize
in interfaceConstraintValidator<ValidHost>
- 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 interfaceConstraintValidator<ValidHost>
- Parameters:
name
- the name to use for error reportingvalue
- the value to validate.- Returns:
true
if the given value is valid.
-
-