Class CheckerURI
- All Implemented Interfaces:
InterfaceChecker<AbstractChecker<URI,
CheckerURI>, URI>
A specialized checker for
URI
objects, providing fluent validation methods
for various URI components such as scheme, host, port, authority, fragment, path, and query.
This class extends AbstractChecker
to enable chainable assertions on URI
instances.
It supports both default and custom naming for checkers, and provides static factory methods
for convenient instantiation from URI
or String
representations.
Usage Example:
CheckerURI.check("https://example.com", "ExampleURI")
.isAbsolute()
.hasHost("example.com")
.hasPath("/index.html");
Each validation method returns this
for fluent chaining.
-
Field Summary
Fields inherited from class util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CheckerURI
(URI uri, String name) Constructs a newCheckerURI
with the specifiedURI
and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerURI
Creates a CheckerURI from a string path with a default name.static CheckerURI
Creates a CheckerURI from a string path and assigns a custom name.static CheckerURI
Creates a CheckerURI for the given URI with a default name.static CheckerURI
Creates a CheckerURI for the given URI and assigns a custom name.Checks if the URI has an authority component.hasAuthority
(String... authorities) Checks if the URI's authority matches any of the specified authorities.Checks if the URI has a fragment component.hasFrament
(String... fragments) Checks if the URI's fragment matches any of the specified fragments.hasHost()
Checks if the URI has a host component.Checks if the URI's host matches any of the specified hosts.hasPath()
Checks if the URI has a path component.Checks if the URI's path matches any of the specified paths.hasPort()
Checks if the URI has a port component.hasPort
(int... ports) Checks if the URI's port matches any of the specified ports.hasQuery()
Checks if the URI has a query component.Checks if the URI's query matches any of the specified queries.Checks if the URI has a scheme component.Checks if the URI's scheme matches any of the specified schemes.Checks if the URI is absolute (has a scheme).Checks if the URI is relative (does not have a scheme).protected CheckerURI
self()
Returns this instance (for fluent API).Methods inherited from class util.AbstractChecker
checkProperty, checkProperty, checkProperty, end, getMethod, getObject, getProperty, hasErrors, hasNotErrors, is, is, isEqual, isNonNull, isNot, isNot, isNull, notSaveErrors, saveErrors, show, showNotThrownException, showThrownException, stop
-
Constructor Details
-
CheckerURI
-
-
Method Details
-
check
Creates a CheckerURI for the given URI and assigns a custom name.- Parameters:
uri
- the URI to checkname
- the name to assign to this checker- Returns:
- a CheckerURI instance for the given URI
-
check
Creates a CheckerURI from a string path and assigns a custom name.- Parameters:
path
- the string representation of the URIname
- the name to assign to this checker- Returns:
- a CheckerURI instance for the given path
-
check
Creates a CheckerURI for the given URI with a default name.- Parameters:
uri
- the URI to check- Returns:
- a CheckerURI instance for the given URI
-
check
Creates a CheckerURI from a string path with a default name.- Parameters:
path
- the string representation of the URI- Returns:
- a CheckerURI instance for the given path
-
self
Returns this instance (for fluent API).- Specified by:
self
in classAbstractChecker<URI,
CheckerURI> - Returns:
- this CheckerURI instance
-
isAbsolute
Checks if the URI is absolute (has a scheme).- Returns:
- this CheckerURI instance
-
isRelative
Checks if the URI is relative (does not have a scheme).- Returns:
- this CheckerURI instance
-
hasSqueme
Checks if the URI has a scheme component.- Returns:
- this CheckerURI instance
-
hasSqueme
Checks if the URI's scheme matches any of the specified schemes.- Parameters:
squemes
- the schemes to check for- Returns:
- this CheckerURI instance
-
hasHost
Checks if the URI has a host component.- Returns:
- this CheckerURI instance
-
hasHost
Checks if the URI's host matches any of the specified hosts.- Parameters:
hosts
- the hosts to check for- Returns:
- this CheckerURI instance
-
hasPort
Checks if the URI has a port component.- Returns:
- this CheckerURI instance
-
hasPort
Checks if the URI's port matches any of the specified ports.- Parameters:
ports
- the ports to check for- Returns:
- this CheckerURI instance
-
hasAuthority
Checks if the URI has an authority component.- Returns:
- this CheckerURI instance
-
hasAuthority
Checks if the URI's authority matches any of the specified authorities.- Parameters:
authorities
- the authorities to check for- Returns:
- this CheckerURI instance
-
hasFrament
Checks if the URI has a fragment component.- Returns:
- this CheckerURI instance
-
hasFrament
Checks if the URI's fragment matches any of the specified fragments.- Parameters:
fragments
- the fragments to check for- Returns:
- this CheckerURI instance
-
hasPath
Checks if the URI has a path component.- Returns:
- this CheckerURI instance
-
hasPath
Checks if the URI's path matches any of the specified paths.- Parameters:
paths
- the paths to check for- Returns:
- this CheckerURI instance
-
hasQuery
Checks if the URI has a query component.- Returns:
- this CheckerURI instance
-
hasQuery
Checks if the URI's query matches any of the specified queries.- Parameters:
queries
- the queries to check for- Returns:
- this CheckerURI instance
-