Package org.apache.pulsar.common.util
Class URIPreconditions
java.lang.Object
org.apache.pulsar.common.util.URIPreconditions
Static convenience URI checker.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Check whether the given string is a legal URI and passes the user's check.static void
Check whether the given string is a legal URI and passes the user's check.static void
checkURIIfPresent
(String uri, Predicate<URI> predicate) Check whether the given string is a legal URI and passes the user's check.static void
checkURIIfPresent
(String uri, Predicate<URI> predicate, String errorMessage) Check whether the given string is a legal URI and passes the user's check.
-
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 Stringpredicate
- 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 Stringpredicate
- 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 Stringpredicate
- User defined ruleerrorMessage
- 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 Stringpredicate
- User defined ruleerrorMessage
- Error message- Throws:
IllegalArgumentException
- Illegal URI or failed in the user's rules
-