• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpParams.java $
3  * $Revision: 610763 $
4  * $Date: 2008-01-10 04:01:13 -0800 (Thu, 10 Jan 2008) $
5  *
6  * ====================================================================
7  * Licensed to the Apache Software Foundation (ASF) under one
8  * or more contributor license agreements.  See the NOTICE file
9  * distributed with this work for additional information
10  * regarding copyright ownership.  The ASF licenses this file
11  * to you under the Apache License, Version 2.0 (the
12  * "License"); you may not use this file except in compliance
13  * with the License.  You may obtain a copy of the License at
14  *
15  *   http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing,
18  * software distributed under the License is distributed on an
19  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20  * KIND, either express or implied.  See the License for the
21  * specific language governing permissions and limitations
22  * under the License.
23  * ====================================================================
24  *
25  * This software consists of voluntary contributions made by many
26  * individuals on behalf of the Apache Software Foundation.  For more
27  * information on the Apache Software Foundation, please see
28  * <http://www.apache.org/>.
29  *
30  */
31 
32 package org.apache.http.params;
33 
34 /**
35  * Represents a collection of HTTP protocol and framework parameters.
36  *
37  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
38  *
39  * @version $Revision: 610763 $
40  *
41  * @since 4.0
42  */
43 public interface HttpParams {
44 
45     /**
46      * Obtains the value of the given parameter.
47      *
48      * @param name the parent name.
49      *
50      * @return  an object that represents the value of the parameter,
51      *          <code>null</code> if the parameter is not set or if it
52      *          is explicitly set to <code>null</code>
53      *
54      * @see #setParameter(String, Object)
55      */
getParameter(String name)56     Object getParameter(String name);
57 
58     /**
59      * Assigns the value to the parameter with the given name.
60      *
61      * @param name parameter name
62      * @param value parameter value
63      */
setParameter(String name, Object value)64     HttpParams setParameter(String name, Object value);
65 
66     /**
67      * Creates a copy of these parameters.
68      *
69      * @return  a new set of parameters holding the same values as this one
70      */
copy()71     HttpParams copy();
72 
73     /**
74      * Removes the parameter with the specified name.
75      *
76      * @param name parameter name
77      *
78      * @return true if the parameter existed and has been removed, false else.
79      */
removeParameter(String name)80     boolean removeParameter(String name);
81 
82     /**
83      * Returns a {@link Long} parameter value with the given name.
84      * If the parameter is not explicitly set, the default value is returned.
85      *
86      * @param name the parent name.
87      * @param defaultValue the default value.
88      *
89      * @return a {@link Long} that represents the value of the parameter.
90      *
91      * @see #setLongParameter(String, long)
92      */
getLongParameter(String name, long defaultValue)93     long getLongParameter(String name, long defaultValue);
94 
95     /**
96      * Assigns a {@link Long} to the parameter with the given name
97      *
98      * @param name parameter name
99      * @param value parameter value
100      */
setLongParameter(String name, long value)101     HttpParams setLongParameter(String name, long value);
102 
103     /**
104      * Returns an {@link Integer} parameter value with the given name.
105      * If the parameter is not explicitly set, the default value is returned.
106      *
107      * @param name the parent name.
108      * @param defaultValue the default value.
109      *
110      * @return a {@link Integer} that represents the value of the parameter.
111      *
112      * @see #setIntParameter(String, int)
113      */
getIntParameter(String name, int defaultValue)114     int getIntParameter(String name, int defaultValue);
115 
116     /**
117      * Assigns an {@link Integer} to the parameter with the given name
118      *
119      * @param name parameter name
120      * @param value parameter value
121      */
setIntParameter(String name, int value)122     HttpParams setIntParameter(String name, int value);
123 
124     /**
125      * Returns a {@link Double} parameter value with the given name.
126      * If the parameter is not explicitly set, the default value is returned.
127      *
128      * @param name the parent name.
129      * @param defaultValue the default value.
130      *
131      * @return a {@link Double} that represents the value of the parameter.
132      *
133      * @see #setDoubleParameter(String, double)
134      */
getDoubleParameter(String name, double defaultValue)135     double getDoubleParameter(String name, double defaultValue);
136 
137     /**
138      * Assigns a {@link Double} to the parameter with the given name
139      *
140      * @param name parameter name
141      * @param value parameter value
142      */
setDoubleParameter(String name, double value)143     HttpParams setDoubleParameter(String name, double value);
144 
145     /**
146      * Returns a {@link Boolean} parameter value with the given name.
147      * If the parameter is not explicitly set, the default value is returned.
148      *
149      * @param name the parent name.
150      * @param defaultValue the default value.
151      *
152      * @return a {@link Boolean} that represents the value of the parameter.
153      *
154      * @see #setBooleanParameter(String, boolean)
155      */
getBooleanParameter(String name, boolean defaultValue)156     boolean getBooleanParameter(String name, boolean defaultValue);
157 
158     /**
159      * Assigns a {@link Boolean} to the parameter with the given name
160      *
161      * @param name parameter name
162      * @param value parameter value
163      */
setBooleanParameter(String name, boolean value)164     HttpParams setBooleanParameter(String name, boolean value);
165 
166     /**
167      * Checks if a boolean parameter is set to <code>true</code>.
168      *
169      * @param name parameter name
170      *
171      * @return <tt>true</tt> if the parameter is set to value <tt>true</tt>,
172      *         <tt>false</tt> if it is not set or set to <code>false</code>
173      */
isParameterTrue(String name)174     boolean isParameterTrue(String name);
175 
176     /**
177      * Checks if a boolean parameter is not set or <code>false</code>.
178      *
179      * @param name parameter name
180      *
181      * @return <tt>true</tt> if the parameter is either not set or
182      *         set to value <tt>false</tt>,
183      *         <tt>false</tt> if it is set to <code>true</code>
184      */
isParameterFalse(String name)185     boolean isParameterFalse(String name);
186 
187 }
188