com.google.common.base.Predicate<java.net.URI>
, Filter<java.net.URI>
, FlyweightPrototype<Filter<java.net.URI>>
, java.util.function.Predicate<java.net.URI>
public class HostEquals extends AbstractFilter<java.net.URI>
Note that apply(URI)
will throw an IllegalArgumentException
if the argument has a null
host.
FILTER_PACKAGE_NAME
Constructor | Description |
---|---|
HostEquals(java.lang.String host) |
Creates a filter that only accepts URLs with a given host.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
apply(java.net.URI uri) |
Apply the filter to a given URI
|
Filter<java.net.URI> |
copy() |
|
boolean |
equals(java.lang.Object x) |
Compare this object with a given generic one
|
int |
hashCode() |
|
java.lang.String |
toString() |
A string representation of the state of this object, that is just the host allowed.
|
static HostEquals |
valueOf(java.lang.String spec) |
Get a new
HostEquals that will accept only URIs whose host part is equal to spec |
toString
public HostEquals(java.lang.String host)
host
- the accepted host.public boolean apply(java.net.URI uri)
uri
- the URI to be filtereduri
is equal to the inner hostpublic static HostEquals valueOf(java.lang.String spec)
HostEquals
that will accept only URIs whose host part is equal to specspec
- a string that will be used to compare host parts of the URIHostEquals
that will accept only URIs whose host is specpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object x)
equals
in interface com.google.common.base.Predicate<java.net.URI>
equals
in class java.lang.Object
true
if x
is an instance of HostEquals
and the URIs allowed by x
are allowed by this and vice versapublic int hashCode()
hashCode
in class java.lang.Object
public Filter<java.net.URI> copy()