Package com.example.common.validate
Class ValidatorFactory
java.lang.Object
com.example.common.validate.ValidatorFactory
The ValidatorFactory class provides static methods for creating instances of various Validators.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidatorInterface
getIntegerNumberValidator
(String value) Creates an ValidateIntegerNumber Validator with the specified value.static ValidatorInterface
getIpValidator
(String value) Creates an IpValidator Validator with the specified value.static ValidatorInterface
getNotUsedPortValidation
(String value, TransportFactory transportFactory) Creates a NotUsedPortsValidator Validator with the specified value and transport factory.static ValidatorInterface
getPortValidation
(String value, int minPort, int maxPort, Boolean withValidationIsUsed, TransportFactory transportFactory) Creates a compound PortValidation Validator with integer number, range and not used port validation.static ValidatorInterface
getRangeNumberValidation
(String value, int min, int max) Creates a RangeNumberValidation Validator with the specified value, minimum, and maximum values.
-
Constructor Details
-
ValidatorFactory
public ValidatorFactory()
-
-
Method Details
-
getRangeNumberValidation
Creates a RangeNumberValidation Validator with the specified value, minimum, and maximum values.- Parameters:
value
- the value to validatemin
- the minimum value of the rangemax
- the maximum value of the range- Returns:
- a RangeNumberValidation Validator
-
getIntegerNumberValidator
Creates an ValidateIntegerNumber Validator with the specified value.- Parameters:
value
- the value to validate as an integer number- Returns:
- an ValidateIntegerNumber Validator
-
getIpValidator
Creates an IpValidator Validator with the specified value.- Parameters:
value
- the IP address value to validate- Returns:
- an IpValidator Validator
-
getNotUsedPortValidation
public static ValidatorInterface getNotUsedPortValidation(String value, TransportFactory transportFactory) Creates a NotUsedPortsValidator Validator with the specified value and transport factory.- Parameters:
value
- the value representing a port number to validatetransportFactory
- the TransportFactory object for creating listeners- Returns:
- a NotUsedPortsValidator Validator
-
getPortValidation
public static ValidatorInterface getPortValidation(String value, int minPort, int maxPort, Boolean withValidationIsUsed, TransportFactory transportFactory) Creates a compound PortValidation Validator with integer number, range and not used port validation.- Parameters:
value
- the value representing a port number to validateminPort
- the minimum port number allowedmaxPort
- the maximum port number allowedwithValidationIsUsed
- flag to indicate whether to perform not used port validationtransportFactory
- the TransportFactory object for creating listeners- Returns:
- a validation chain of PortValidation Validator
-