AdDescriptorType - Type of descriptor expected from PMCommunicatorListener callback.public class PMCommunicator<AdDescriptorType> extends java.lang.Object implements PMNetworkHandler.PMNetworkListener<org.json.JSONObject>, PMResponseParsing.PMResponseParserListener, PMAdBuilding.PMAdBuilderListener<AdDescriptorType>
| Modifier and Type | Class and Description |
|---|---|
static interface |
PMCommunicator.PMCommunicatorListener<AdDescriptorType>
Interface to get the callback from PMCommunicator
|
| Constructor and Description |
|---|
PMCommunicator(PMRequestBuilding requestBuilder,
PMResponseParsing responseParser,
PMAdBuilding adBuilder,
PMNetworkHandler networkHandler)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
adBuilderOnError(POBError error) |
void |
adBuilderOnSuccess(AdDescriptorType adDescriptor) |
void |
cancel()
Cancels any outstanding network call.
|
void |
onFailure(POBError error) |
void |
onSuccess(org.json.JSONObject response)
Called when a response is received.
|
void |
parserOnError(POBError error) |
void |
parserOnSuccess(PMAdResponse adResponse) |
void |
requestAd()
Request an ad.
|
void |
setListener(PMCommunicator.PMCommunicatorListener listener)
Sets the listener to get the callback
|
public PMCommunicator(PMRequestBuilding requestBuilder, PMResponseParsing responseParser, PMAdBuilding adBuilder, PMNetworkHandler networkHandler)
requestBuilder - PMRequestBuilding instance to forms the requestresponseParser - PMResponseParsing instance to parse responseadBuilder - PMAdBuilding instance to format the parsed responsenetworkHandler - PMNetworkHandler instance to make a network callpublic void setListener(PMCommunicator.PMCommunicatorListener listener)
listener - The listener object to get the callbackpublic void requestAd()
public void cancel()
public void adBuilderOnSuccess(AdDescriptorType adDescriptor)
adBuilderOnSuccess in interface PMAdBuilding.PMAdBuilderListener<AdDescriptorType>public void adBuilderOnError(POBError error)
adBuilderOnError in interface PMAdBuilding.PMAdBuilderListener<AdDescriptorType>public void parserOnSuccess(PMAdResponse adResponse)
parserOnSuccess in interface PMResponseParsing.PMResponseParserListenerpublic void parserOnError(POBError error)
parserOnError in interface PMResponseParsing.PMResponseParserListenerpublic void onSuccess(org.json.JSONObject response)
PMNetworkHandler.PMNetworkListeneronSuccess in interface PMNetworkHandler.PMNetworkListener<org.json.JSONObject>response - of generic typepublic void onFailure(POBError error)
onFailure in interface PMNetworkHandler.PMNetworkListener<org.json.JSONObject>error - Error object