• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
ClientParamsStack Class Reference

Represents a stack of parameter collections. More...

Inheritance diagram for ClientParamsStack:
AbstractHttpParams HttpParams

Description

When retrieving a parameter, the stack is searched in a fixed order and the first match returned. Setting parameters via the stack is not supported. To minimize overhead, the stack has a fixed size and does not maintain an internal array. The supported stack entries, sorted by increasing priority, are:

  1. Application parameters: expected to be the same for all clients used by an application. These provide "global", that is application-wide, defaults.
  2. Client parameters: specific to an instance of HttpClient . These provide client specific defaults.
  3. Request parameters: specific to a single request execution. For overriding client and global defaults.
  4. Override parameters: specific to an instance of HttpClient . These can be used to set parameters that cannot be overridden on a per-request basis.

Each stack entry may be null. That is preferable over an empty params collection, since it avoids searching the empty collection when looking up parameters.

Author
Roland Weber
Version
Revision
673450

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

 ClientParamsStack (HttpParams aparams, HttpParams cparams, HttpParams rparams, HttpParams oparams)
 Creates a new parameter stack from elements. More...
 
 ClientParamsStack (ClientParamsStack stack)
 Creates a copy of a parameter stack. More...
 
 ClientParamsStack (ClientParamsStack stack, HttpParams aparams, HttpParams cparams, HttpParams rparams, HttpParams oparams)
 Creates a modified copy of a parameter stack. More...
 
final HttpParams getApplicationParams ()
 Obtains the application parameters of this stack. More...
 
final HttpParams getClientParams ()
 Obtains the client parameters of this stack. More...
 
final HttpParams getRequestParams ()
 Obtains the request parameters of this stack. More...
 
final HttpParams getOverrideParams ()
 Obtains the override parameters of this stack. More...
 
Object getParameter (String name)
 Obtains a parameter from this stack. More...
 
HttpParams setParameter (String name, Object value) throws UnsupportedOperationException
 Does not set a parameter. More...
 
boolean removeParameter (String name)
 Does not remove a parameter. More...
 
HttpParams copy ()
 Does not copy parameters. More...
 
- Public Member Functions inherited from AbstractHttpParams
long getLongParameter (final String name, long defaultValue)
 Returns a Long parameter value with the given name. More...
 
HttpParams setLongParameter (final String name, long value)
 Assigns a Long to the parameter with the given name. More...
 
int getIntParameter (final String name, int defaultValue)
 Returns an Integer parameter value with the given name. More...
 
HttpParams setIntParameter (final String name, int value)
 Assigns an Integer to the parameter with the given name. More...
 
double getDoubleParameter (final String name, double defaultValue)
 Returns a Double parameter value with the given name. More...
 
HttpParams setDoubleParameter (final String name, double value)
 Assigns a Double to the parameter with the given name. More...
 
boolean getBooleanParameter (final String name, boolean defaultValue)
 Returns a Boolean parameter value with the given name. More...
 
HttpParams setBooleanParameter (final String name, boolean value)
 Assigns a Boolean to the parameter with the given name. More...
 
boolean isParameterTrue (final String name)
 Checks if a boolean parameter is set to true. More...
 
boolean isParameterFalse (final String name)
 Checks if a boolean parameter is not set or false. More...
 

Protected Attributes

final HttpParams applicationParams
 The application parameter collection, or null. More...
 
final HttpParams clientParams
 The client parameter collection, or null. More...
 
final HttpParams requestParams
 The request parameter collection, or null. More...
 
final HttpParams overrideParams
 The override parameter collection, or null. More...
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractHttpParams
 AbstractHttpParams ()
 Instantiates parameters.
 

Constructor & Destructor Documentation

◆ ClientParamsStack() [1/3]

ClientParamsStack ( HttpParams  aparams,
HttpParams  cparams,
HttpParams  rparams,
HttpParams  oparams 
)

The arguments will be stored as-is, there is no copying to prevent modification.

Parameters
aparamsapplication parameters, or null
cparamsclient parameters, or null
rparamsrequest parameters, or null
oparamsoverride parameters, or null

◆ ClientParamsStack() [2/3]

The new stack will have the exact same entries as the argument stack. There is no copying of parameters.

Parameters
stackthe stack to copy

◆ ClientParamsStack() [3/3]

ClientParamsStack ( ClientParamsStack  stack,
HttpParams  aparams,
HttpParams  cparams,
HttpParams  rparams,
HttpParams  oparams 
)

The new stack will contain the explicitly passed elements. For elements where the explicit argument is null, the corresponding element from the argument stack is used. There is no copying of parameters.

Parameters
stackthe stack to modify
aparamsapplication parameters, or null
cparamsclient parameters, or null
rparamsrequest parameters, or null
oparamsoverride parameters, or null

Member Function Documentation

◆ getApplicationParams()

final HttpParams getApplicationParams ( )
Returns
the application parameters, or null

◆ getClientParams()

final HttpParams getClientParams ( )
Returns
the client parameters, or null

◆ getRequestParams()

final HttpParams getRequestParams ( )
Returns
the request parameters, or null

◆ getOverrideParams()

final HttpParams getOverrideParams ( )
Returns
the override parameters, or null

◆ getParameter()

Object getParameter ( String  name)

See class comment for search order.

Parameters
namethe name of the parameter to obtain
Returns
the highest-priority value for that parameter, or null if it is not set anywhere in this stack

Implements HttpParams.

◆ setParameter()

HttpParams setParameter ( String  name,
Object  value 
) throws UnsupportedOperationException

Parameter stacks are read-only. It is possible, though discouraged, to access and modify specific stack entries. Derived classes may change this behavior.

Parameters
nameignored
valueignored
Returns
nothing
Exceptions
UnsupportedOperationExceptionalways

Implements HttpParams.

◆ removeParameter()

boolean removeParameter ( String  name)

Parameter stacks are read-only. It is possible, though discouraged, to access and modify specific stack entries. Derived classes may change this behavior.

Parameters
nameignored
Returns
nothing
Exceptions
UnsupportedOperationExceptionalways

Implements HttpParams.

◆ copy()

HttpParams copy ( )

Parameter stacks are lightweight objects, expected to be instantiated as needed and to be used only in a very specific context. On top of that, they are read-only. The typical copy operation to prevent accidental modification of parameters passed by the application to a framework object is therefore pointless and disabled. Create a new stack if you really need a copy.
Derived classes may change this behavior.

Returns
this parameter stack

Implements HttpParams.

Member Data Documentation

◆ applicationParams

final HttpParams applicationParams
protected

◆ clientParams

final HttpParams clientParams
protected

◆ requestParams

final HttpParams requestParams
protected

◆ overrideParams

final HttpParams overrideParams
protected