com.google.common.base.Predicate<org.apache.http.HttpResponse>
, Filter<org.apache.http.HttpResponse>
, FlyweightPrototype<Filter<org.apache.http.HttpResponse>>
, java.util.function.Predicate<org.apache.http.HttpResponse>
public class StatusCategory extends AbstractFilter<org.apache.http.HttpResponse>
FILTER_PACKAGE_NAME
Constructor | Description |
---|---|
StatusCategory(int category) |
Creates a filter that only accepts responses of the given category.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
apply(org.apache.http.HttpResponse x) |
Apply the filter to a given
HttpResponse |
Filter<org.apache.http.HttpResponse> |
copy() |
|
boolean |
equals(java.lang.Object x) |
Compare this filter with a generic object
|
int |
hashCode() |
|
java.lang.String |
toString() |
A string representation of this
|
static StatusCategory |
valueOf(java.lang.String spec) |
Get a new
StatusCategory accepting only fetched response whose status category (status/100) has a given value |
toString
public StatusCategory(int category)
category
- the accepted category.public boolean apply(org.apache.http.HttpResponse x)
HttpResponse
x
- the HttpResponse
to be filteredtrue
if the status code of x
is equal to the category class allowedpublic static StatusCategory valueOf(java.lang.String spec)
StatusCategory
accepting only fetched response whose status category (status/100) has a given valuespec
- a stringStatusCategory
accepting only fetched response whose status category (status/100) has value 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<org.apache.http.HttpResponse>
equals
in class java.lang.Object
x
- the object to be comparedtrue
if x
is instance of StatusCategory
and the category accepted by x
is accepted by this and vice versapublic int hashCode()
hashCode
in class java.lang.Object
public Filter<org.apache.http.HttpResponse> copy()