Class RequiredValidator
- java.lang.Object
-
- org.apache.logging.log4j.core.config.plugins.validation.validators.RequiredValidator
-
- All Implemented Interfaces:
ConstraintValidator<Required>
public class RequiredValidator extends Object implements ConstraintValidator<Required>
Validator that checks an object for emptiness. Emptiness is defined here as:- The value
null
- An object of type
CharSequence
with length 0 - An empty array
- An empty
Collection
- An empty
Map
- Since:
- 2.1
-
-
Constructor Summary
Constructors Constructor Description RequiredValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
initialize(Required anAnnotation)
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(Required anAnnotation)
Description copied from interface:ConstraintValidator
Called before this validator is used with the constraint annotation value.- Specified by:
initialize
in interfaceConstraintValidator<Required>
- Parameters:
anAnnotation
- 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<Required>
- Parameters:
name
- the name to use for error reportingvalue
- the value to validate.- Returns:
true
if the given value is valid.
-
-