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 HostEndsWith 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 |
---|---|
HostEndsWith(java.lang.String suffix) |
Creates a filter that only accepts URLs whose host part has a given suffix.
|
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 suffix allowed.
|
static HostEndsWith |
valueOf(java.lang.String spec) |
Get a new
HostEndsWith that will accept only URIs whose suffix is given in input |
toString
public HostEndsWith(java.lang.String suffix)
suffix
- the accepted suffix.public boolean apply(java.net.URI uri)
uri
- the URI to be filteredtrue
if the host part of uri
ends with the allowed suffixpublic static HostEndsWith valueOf(java.lang.String spec)
HostEndsWith
that will accept only URIs whose suffix is given in inputspec
- a string that will be used to compare suffixesHostEndsWith
that will accept only URIs whose suffix is spec
public 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
x
is an instance of HostEndsWith
and the suffix allowed by x
is allowed by this and vice versapublic int hashCode()
hashCode
in class java.lang.Object
public Filter<java.net.URI> copy()