Class NotUsedPortsValidator

java.lang.Object
com.example.common.validate.BaseValidator
com.example.common.validate.NotUsedPortsValidator
All Implemented Interfaces:
ValidatorInterface

public class NotUsedPortsValidator extends BaseValidator implements ValidatorInterface
The NotUsedPortsValidator class extends the BaseValidator class and implements the ValidatorInterface. It validates if a port is not already in use by creating a transport listener.
  • Constructor Details

    • NotUsedPortsValidator

      public NotUsedPortsValidator(String value, TransportFactory transportFactory)
      Constructs a NotUsedPortsValidator with the specified value and transport factory.
      Parameters:
      value - the value representing a port number to validate
      transportFactory - the TransportFactory object for creating listeners
  • Method Details

    • validate

      public boolean validate()
      Validates if the specified port is not already in use by creating a transport listener on that port.
      Specified by:
      validate in interface ValidatorInterface
      Returns:
      true if the port is available, false if the port is already in use