Package eu.clarin.sru.client
Class SRUScanResponse
- java.lang.Object
-
- eu.clarin.sru.client.SRUScanResponse
-
public final class SRUScanResponse extends Object
A response to a scan request.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<SRUDiagnostic>getDiagnostics()Get the diagnostics for this response.intgetDiagnosticsCount()Get the number of diagnostics in the response.List<SRUExtraResponseData>getExtraResponseData()Get the extra response data for this result.<V extends SRUExtraResponseData>
List<V>getExtraResponseData(Class<V> clazz)Get the extra response data of a specific class for this result.intgetExtraResponseDataCount()Return the number of extra response data records attached to the response.<V extends SRUExtraResponseData>
VgetFirstExtraResponseData(Class<V> clazz)Get the first instance of extra response data of a specific class for this result.TgetRequest()Get the request that produced this response.List<SRUTerm>getTerms()Get list of terms matched by the request.intgetTermsCount()Get the number of terms returned by the request.longgetTimeNetwork()Get the number of milliseconds this request spend waiting for network operations to finish.longgetTimeProcessing()Get the number of milliseconds the client was busy processing the results sent from the endpoint.longgetTimeTotal()Get the total number of milliseconds elapsed for this request.longgetTimeWait()Get the number of milliseconds this request has been queued before it was processed by the client.longgetTotalBytesTransferred()Get the total number of bytes transferred for this request.booleanhasDiagnostics()Check, if the response contains any diagnostics.booleanhasExtraResponseData()Check, if this response has any extra response data attached to the response.<V extends SRUExtraResponseData>
booleanhasExtraResponseData(Class<V> clazz)Check, if this response has any extra response data of a specific class attached to it.booleanhasTerms()Check, if response contains any terms.
-
-
-
Method Detail
-
getTerms
public List<SRUTerm> getTerms()
Get list of terms matched by the request.- Returns:
- a list of terms or
nullif no terms matched the request.
-
hasTerms
public boolean hasTerms()
Check, if response contains any terms.- Returns:
trueof response contains terms,falseotherwise
-
getTermsCount
public int getTermsCount()
Get the number of terms returned by the request.- Returns:
- the number of terms or
0if none
-
getRequest
public T getRequest()
Get the request that produced this response.- Returns:
- the request
-
getDiagnostics
public List<SRUDiagnostic> getDiagnostics()
Get the diagnostics for this response.- Returns:
- diagnostics for this response or
nullif none
-
hasDiagnostics
public boolean hasDiagnostics()
Check, if the response contains any diagnostics.NB: Surrogate diagnostics are not covered by this.
- Returns:
trueif response contains any diagnostic,falseotherwise
-
getDiagnosticsCount
public int getDiagnosticsCount()
Get the number of diagnostics in the response.NB: Surrogate diagnostics are not covered by this.
- Returns:
- the number of diagnostics or
0is none
-
getExtraResponseData
public List<SRUExtraResponseData> getExtraResponseData()
Get the extra response data for this result.- Returns:
- get a list of
SRUExtraResponseDatainstances for the extra response data from the SRU response ornullif none are available
-
hasExtraResponseData
public boolean hasExtraResponseData()
Check, if this response has any extra response data attached to the response.- Returns:
trueif extra response is attached,falseotherwise
-
getExtraResponseDataCount
public int getExtraResponseDataCount()
Return the number of extra response data records attached to the response.- Returns:
- the number of records, or
0is none
-
getExtraResponseData
public <V extends SRUExtraResponseData> List<V> getExtraResponseData(Class<V> clazz)
Get the extra response data of a specific class for this result.- Type Parameters:
V- the type ofSRUExtraResponseDatato check for- Parameters:
clazz- the specific class to check for- Returns:
- a list of
SRUExtraResponseDatainstances for the extra response data from the SRU response ornullif none are available
-
getFirstExtraResponseData
public <V extends SRUExtraResponseData> V getFirstExtraResponseData(Class<V> clazz)
Get the first instance of extra response data of a specific class for this result.- Type Parameters:
V- the type ofSRUExtraResponseDatato check for- Parameters:
clazz- the specific class to check for- Returns:
- a list of
SRUExtraResponseDatainstances for the extra response data from the SRU response ornullif none are available
-
hasExtraResponseData
public <V extends SRUExtraResponseData> boolean hasExtraResponseData(Class<V> clazz)
Check, if this response has any extra response data of a specific class attached to it.- Type Parameters:
V- the type ofSRUExtraResponseDatato check for- Parameters:
clazz- the specific class to check for- Returns:
trueif extra response is attached,falseotherwise
-
getTotalBytesTransferred
public long getTotalBytesTransferred()
Get the total number of bytes transferred for this request.- Returns:
- the total number of bytes or
-1if not available
-
getTimeTotal
public long getTimeTotal()
Get the total number of milliseconds elapsed for this request.- Returns:
- the total number of milliseconds or
-1if not available
-
getTimeWait
public long getTimeWait()
Get the number of milliseconds this request has been queued before it was processed by the client.- Returns:
- the number of milliseconds queued or
-1if not available
-
getTimeNetwork
public long getTimeNetwork()
Get the number of milliseconds this request spend waiting for network operations to finish.- Returns:
- the number of milliseconds spend in waiting on network or
-1if not available
-
getTimeProcessing
public long getTimeProcessing()
Get the number of milliseconds the client was busy processing the results sent from the endpoint.- Returns:
- the number of milliseconds spend in processing or
-1if not available
-
-