Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.base.rest;
  
  import java.util.Map;
  import java.util.UUID;
  
APIContext wraps wire-level parameters for the API call. AccessToken, which is essentially an OAuth token, is treated as a mandatory parameter for (PayPal REST APIs). RequestId is generated if not supplied for marking Idempotency of the API call. OAuth token can be generated using OAuthTokenCredential. The Application Header property may be used by clients to access application level headers. The clients are responsible to cast the Application Header property to appropriate type.

Author(s):
kjayakumar
 
 public class APIContext extends BaseAPIContext {

OAuth Token
 
 	private String accessToken;

Request Id
 
 	private String requestId;

Parameter to mask RequestId
 
 	private boolean maskRequestId;

 
 	private SDKVersion sdkVersion;

Default Constructor
 
 	public APIContext() {
 		super();
 	}

APIContext, requestId is auto generated, calling setMaskRequestId(true) will override the requestId getter to return null

Parameters:
accessToken OAuthToken required for the call. OAuth token used by the REST API service. The token should be of the form 'Bearer xxxx..'. See OAuthTokenCredential to generate OAuthToken
 
 	public APIContext(String accessToken) {
 		super();
 		if (accessToken == null || accessToken.length() <= 0) {
 			throw new IllegalArgumentException("AccessToken cannot be null");
 		}
 		this. = accessToken;
 	}

APIContext

Parameters:
accessToken OAuthToken required for the call. OAuth token used by the REST API service. The token should be of the form 'Bearer xxxx..'. See OAuthTokenCredential to generate OAuthToken
requestId Unique requestId required for the call. Idempotency id, Calling setMaskRequestId(true) will override the requestId getter to return null, which can be used by the client (null check) to forcibly not sent requestId in the API call.
 
 	public APIContext(String accessTokenString requestId) {
 		this(accessToken);
 		if (requestId == null || requestId.length() <= 0) {
 			throw new IllegalArgumentException("RequestId cannot be null");
 		}
 		this. = requestId;
 	}

Returns the Access Token

Returns:
Access Token
 
 	public String getAccessToken() {
 		return ;
 	}

Returns the unique requestId set during creation, if not available and if maskRequestId is set to false returns a generated one, else returns null.

Returns:
requestId
	public String getRequestId() {
		String reqId = null;
		if (!) {
			if ( == null || .length() <= 0) {
			}
			reqId = ;
		}
		return reqId;
	}

Parameters:
maskRequestId the maskRequestId to set
	public void setMaskRequestId(boolean maskRequestId) {
		this. = maskRequestId;
	}

Returns:
the sdkVersion
		return ;
	}

Parameters:
sdkVersion the sdkVersion to set
	public void setSdkVersion(SDKVersion sdkVersion) {
		this. = sdkVersion;
	}

Deprecated:
Use getHTTPHeaders() instead
Returns:
the headersMap
	public Map<StringStringgetHeadersMap() {
		return super.getHTTPHeaders();
	}

Deprecated:
Parameters:
headersMap the headersMap to set
	public void setHeadersMap(Map<StringStringheadersMap) {
		super.setHTTPHeaders(headersMap);
	}
New to GrepCode? Check out our FAQ X