Class RequiredValidator
java.lang.Object
org.apache.logging.log4j.core.config.plugins.validation.validators.RequiredValidator
- All Implemented Interfaces:
ConstraintValidator<Required>
Validator that checks an object for emptiness. Emptiness is defined here as:
- The value
null - An object of type
CharSequencewith length 0 - An empty array
- An empty
Collection - An empty
Map
- Since:
- 2.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(Required anAnnotation) Called before this validator is used with the constraint annotation value.booleanIndicates if the given value is valid.
-
Constructor Details
-
RequiredValidator
public RequiredValidator()
-
-
Method Details
-
initialize
Description copied from interface:ConstraintValidatorCalled before this validator is used with the constraint annotation value.- Specified by:
initializein interfaceConstraintValidator<Required>- Parameters:
anAnnotation- the annotation value this validator will be validating.
-
isValid
Description copied from interface:ConstraintValidatorIndicates if the given value is valid.- Specified by:
isValidin interfaceConstraintValidator<Required>- Parameters:
name- the name to use for error reportingvalue- the value to validate.- Returns:
trueif the given value is valid.
-