Source code: org/apache/http/params/HttpParams.java
1 /*
2 * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpcore/tags/4.0-alpha2/src/java/org/apache/http/params/HttpParams.java $
3 * $Revision: 390703 $
4 * $Date: 2006-04-01 19:35:45 +0200 (Sat, 01 Apr 2006) $
5 *
6 * ====================================================================
7 *
8 * Copyright 1999-2006 The Apache Software Foundation
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ====================================================================
22 *
23 * This software consists of voluntary contributions made by many
24 * individuals on behalf of the Apache Software Foundation. For more
25 * information on the Apache Software Foundation, please see
26 * <http://www.apache.org/>.
27 *
28 */
29
30 package org.apache.http.params;
31
32 /**
33 * This interface represents a collection of HTTP protocol parameters. Protocol parameters
34 * may be linked together to form a hierarchy. If a particular parameter value has not been
35 * explicitly defined in the collection itself, its value will be drawn from the parent
36 * collection of parameters.
37 *
38 * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
39 *
40 * @version $Revision: 390703 $
41 *
42 * @since 3.0
43 */
44 public interface HttpParams {
45
46 /**
47 * Returns the parent collection that this collection will defer to
48 * for a default value if a particular parameter is not explicitly
49 * set in the collection itself
50 *
51 * @return the parent collection to defer to, if a particular parameter
52 * is not explictly set in the collection itself.
53 *
54 * @see #setDefaults(HttpParams)
55 */
56 HttpParams getDefaults();
57
58 /**
59 * Assigns the parent collection that this collection will defer to
60 * for a default value if a particular parameter is not explicitly
61 * set in the collection itself
62 *
63 * @param params the parent collection to defer to, if a particular
64 * parameter is not explictly set in the collection itself.
65 *
66 * @see #getDefaults()
67 */
68 void setDefaults(HttpParams params);
69
70 /**
71 * Returns a parameter value with the given name. If the parameter is
72 * not explicitly defined in this collection, its value will be drawn
73 * from a higer level collection at which this parameter is defined.
74 * If the parameter is not explicitly set anywhere up the hierarchy,
75 * <tt>null</tt> value is returned.
76 *
77 * @param name the parent name.
78 *
79 * @return an object that represents the value of the parameter.
80 *
81 * @see #setParameter(String, Object)
82 */
83 Object getParameter(String name);
84
85 /**
86 * Assigns the value to the parameter with the given name
87 *
88 * @param name parameter name
89 * @param value parameter value
90 */
91 HttpParams setParameter(String name, Object value);
92
93 /**
94 * Returns a {@link Long} parameter value with the given name.
95 * If the parameter is not explicitly defined in this collection, its
96 * value will be drawn from a higer level collection at which this parameter
97 * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
98 * the default value is returned.
99 *
100 * @param name the parent name.
101 * @param defaultValue the default value.
102 *
103 * @return a {@link Long} that represents the value of the parameter.
104 *
105 * @see #setLongParameter(String, long)
106 */
107 long getLongParameter(String name, long defaultValue);
108
109 /**
110 * Assigns a {@link Long} to the parameter with the given name
111 *
112 * @param name parameter name
113 * @param value parameter value
114 */
115 HttpParams setLongParameter(String name, long value);
116
117 /**
118 * Returns an {@link Integer} parameter value with the given name.
119 * If the parameter is not explicitly defined in this collection, its
120 * value will be drawn from a higer level collection at which this parameter
121 * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
122 * the default value is returned.
123 *
124 * @param name the parent name.
125 * @param defaultValue the default value.
126 *
127 * @return a {@link Integer} that represents the value of the parameter.
128 *
129 * @see #setIntParameter(String, int)
130 */
131 int getIntParameter(String name, int defaultValue);
132
133 /**
134 * Assigns an {@link Integer} to the parameter with the given name
135 *
136 * @param name parameter name
137 * @param value parameter value
138 */
139 HttpParams setIntParameter(String name, int value);
140
141 /**
142 * Returns a {@link Double} parameter value with the given name.
143 * If the parameter is not explicitly defined in this collection, its
144 * value will be drawn from a higer level collection at which this parameter
145 * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
146 * the default value is returned.
147 *
148 * @param name the parent name.
149 * @param defaultValue the default value.
150 *
151 * @return a {@link Double} that represents the value of the parameter.
152 *
153 * @see #setDoubleParameter(String, double)
154 */
155 double getDoubleParameter(String name, double defaultValue);
156
157 /**
158 * Assigns a {@link Double} to the parameter with the given name
159 *
160 * @param name parameter name
161 * @param value parameter value
162 */
163 HttpParams setDoubleParameter(String name, double value);
164
165 /**
166 * Returns a {@link Boolean} parameter value with the given name.
167 * If the parameter is not explicitly defined in this collection, its
168 * value will be drawn from a higer level collection at which this parameter
169 * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
170 * the default value is returned.
171 *
172 * @param name the parent name.
173 * @param defaultValue the default value.
174 *
175 * @return a {@link Boolean} that represents the value of the parameter.
176 *
177 * @see #setBooleanParameter(String, boolean)
178 */
179 boolean getBooleanParameter(String name, boolean defaultValue);
180
181 /**
182 * Assigns a {@link Boolean} to the parameter with the given name
183 *
184 * @param name parameter name
185 * @param value parameter value
186 */
187 HttpParams setBooleanParameter(String name, boolean value);
188
189 /**
190 * Returns <tt>true</tt> if the parameter is set at any level, <tt>false</tt> otherwise.
191 *
192 * @param name parameter name
193 *
194 * @return <tt>true</tt> if the parameter is set at any level, <tt>false</tt>
195 * otherwise.
196 */
197 boolean isParameterSet(String name);
198
199 /**
200 * Returns <tt>true</tt> if the parameter is set locally, <tt>false</tt> otherwise.
201 *
202 * @param name parameter name
203 *
204 * @return <tt>true</tt> if the parameter is set locally, <tt>false</tt>
205 * otherwise.
206 */
207 boolean isParameterSetLocally(String name);
208
209 /**
210 * Returns <tt>true</tt> if the parameter is set and is <tt>true</tt>, <tt>false</tt>
211 * otherwise.
212 *
213 * @param name parameter name
214 *
215 * @return <tt>true</tt> if the parameter is set and is <tt>true</tt>, <tt>false</tt>
216 * otherwise.
217 */
218 boolean isParameterTrue(String name);
219
220 /**
221 * Returns <tt>true</tt> if the parameter is either not set or is <tt>false</tt>,
222 * <tt>false</tt> otherwise.
223 *
224 * @param name parameter name
225 *
226 * @return <tt>true</tt> if the parameter is either not set or is <tt>false</tt>,
227 * <tt>false</tt> otherwise.
228 */
229 boolean isParameterFalse(String name);
230
231 }