Class URIPreconditions

java.lang.Object
org.apache.pulsar.common.util.URIPreconditions

@ThreadSafe public class URIPreconditions extends Object
Static convenience URI checker.
  • Constructor Details

    • URIPreconditions

      public URIPreconditions()
  • Method Details

    • checkURI

      public static void checkURI(@Nonnull String uri, @Nonnull Predicate<URI> predicate) throws IllegalArgumentException
      Check whether the given string is a legal URI and passes the user's check.
      Parameters:
      uri - URI String
      predicate - User defined rule
      Throws:
      IllegalArgumentException - Illegal URI or failed in the user's rules
    • checkURIIfPresent

      public static void checkURIIfPresent(@Nullable String uri, @Nonnull Predicate<URI> predicate) throws IllegalArgumentException
      Check whether the given string is a legal URI and passes the user's check.
      Parameters:
      uri - URI String
      predicate - User defined rule
      Throws:
      IllegalArgumentException - Illegal URI or failed in the user's rules
    • checkURIIfPresent

      public static void checkURIIfPresent(@Nullable String uri, @Nonnull Predicate<URI> predicate, @Nullable String errorMessage) throws IllegalArgumentException
      Check whether the given string is a legal URI and passes the user's check.
      Parameters:
      uri - URI String
      predicate - User defined rule
      errorMessage - Error message
      Throws:
      IllegalArgumentException - Illegal URI or failed in the user's rules
    • checkURI

      public static void checkURI(@Nonnull String uri, @Nonnull Predicate<URI> predicate, @Nullable String errorMessage) throws IllegalArgumentException
      Check whether the given string is a legal URI and passes the user's check.
      Parameters:
      uri - URI String
      predicate - User defined rule
      errorMessage - Error message
      Throws:
      IllegalArgumentException - Illegal URI or failed in the user's rules