summaryrefslogtreecommitdiffstats
path: root/mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParams.java
blob: 7eb780b37d503b1d8367121471138f2c8a74bf16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*
 * ====================================================================
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 */

package ch.boye.httpclientandroidlib.params;

/**
 * HttpParams interface represents a collection of immutable values that define
 * a runtime behavior of a component. HTTP parameters should be simple objects:
 * integers, doubles, strings, collections and objects that remain immutable
 * at runtime. HttpParams is expected to be used in 'write once - read many' mode.
 * Once initialized, HTTP parameters are not expected to mutate in
 * the course of HTTP message processing.
 * <p>
 * The purpose of this interface is to define a behavior of other components.
 * Usually each complex component has its own HTTP parameter collection.
 * <p>
 * Instances of this interface can be linked together to form a hierarchy.
 * In the simplest form one set of parameters can use content of another one
 * to obtain default values of parameters not present in the local set.
 *
 * @since 4.0
 *
 * @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
 *  and 'ch.boye.httpclientandroidlib.client.config'
 */
@Deprecated
public interface HttpParams {

    /**
     * Obtains the value of the given parameter.
     *
     * @param name the parent name.
     *
     * @return  an object that represents the value of the parameter,
     *          <code>null</code> if the parameter is not set or if it
     *          is explicitly set to <code>null</code>
     *
     * @see #setParameter(String, Object)
     */
    Object getParameter(String name);

    /**
     * Assigns the value to the parameter with the given name.
     *
     * @param name parameter name
     * @param value parameter value
     */
    HttpParams setParameter(String name, Object value);

    /**
     * Creates a copy of these parameters.
     *
     * @return  a new set of parameters holding the same values as this one
     */
    HttpParams copy();

    /**
     * Removes the parameter with the specified name.
     *
     * @param name parameter name
     *
     * @return true if the parameter existed and has been removed, false else.
     */
    boolean removeParameter(String name);

    /**
     * Returns a {@link Long} parameter value with the given name.
     * If the parameter is not explicitly set, the default value is returned.
     *
     * @param name the parent name.
     * @param defaultValue the default value.
     *
     * @return a {@link Long} that represents the value of the parameter.
     *
     * @see #setLongParameter(String, long)
     */
    long getLongParameter(String name, long defaultValue);

    /**
     * Assigns a {@link Long} to the parameter with the given name
     *
     * @param name parameter name
     * @param value parameter value
     */
    HttpParams setLongParameter(String name, long value);

    /**
     * Returns an {@link Integer} parameter value with the given name.
     * If the parameter is not explicitly set, the default value is returned.
     *
     * @param name the parent name.
     * @param defaultValue the default value.
     *
     * @return a {@link Integer} that represents the value of the parameter.
     *
     * @see #setIntParameter(String, int)
     */
    int getIntParameter(String name, int defaultValue);

    /**
     * Assigns an {@link Integer} to the parameter with the given name
     *
     * @param name parameter name
     * @param value parameter value
     */
    HttpParams setIntParameter(String name, int value);

    /**
     * Returns a {@link Double} parameter value with the given name.
     * If the parameter is not explicitly set, the default value is returned.
     *
     * @param name the parent name.
     * @param defaultValue the default value.
     *
     * @return a {@link Double} that represents the value of the parameter.
     *
     * @see #setDoubleParameter(String, double)
     */
    double getDoubleParameter(String name, double defaultValue);

    /**
     * Assigns a {@link Double} to the parameter with the given name
     *
     * @param name parameter name
     * @param value parameter value
     */
    HttpParams setDoubleParameter(String name, double value);

    /**
     * Returns a {@link Boolean} parameter value with the given name.
     * If the parameter is not explicitly set, the default value is returned.
     *
     * @param name the parent name.
     * @param defaultValue the default value.
     *
     * @return a {@link Boolean} that represents the value of the parameter.
     *
     * @see #setBooleanParameter(String, boolean)
     */
    boolean getBooleanParameter(String name, boolean defaultValue);

    /**
     * Assigns a {@link Boolean} to the parameter with the given name
     *
     * @param name parameter name
     * @param value parameter value
     */
    HttpParams setBooleanParameter(String name, boolean value);

    /**
     * Checks if a boolean parameter is set to <code>true</code>.
     *
     * @param name parameter name
     *
     * @return <tt>true</tt> if the parameter is set to value <tt>true</tt>,
     *         <tt>false</tt> if it is not set or set to <code>false</code>
     */
    boolean isParameterTrue(String name);

    /**
     * Checks if a boolean parameter is not set or <code>false</code>.
     *
     * @param name parameter name
     *
     * @return <tt>true</tt> if the parameter is either not set or
     *         set to value <tt>false</tt>,
     *         <tt>false</tt> if it is set to <code>true</code>
     */
    boolean isParameterFalse(String name);

}