View Javadoc

1   /*
2    * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/params/HttpParams.java,v 1.6 2004/05/13 04:01:22 mbecke Exp $
3    * $Revision: 155418 $
4    * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
5    *
6    * ====================================================================
7    *
8    *  Copyright 1999-2004 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.commons.httpclient.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@ural.ru">Oleg Kalnichevski</a>
39   * 
40   * @version $Revision: 155418 $
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      public 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      public void setDefaults(final 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      public Object getParameter(final 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      public void setParameter(final String name, final 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     public long getLongParameter(final 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     public void setLongParameter(final 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     public int getIntParameter(final 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     public void setIntParameter(final 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     public double getDoubleParameter(final 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     public void setDoubleParameter(final 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     public boolean getBooleanParameter(final 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     public void setBooleanParameter(final 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     public boolean isParameterSet(final 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     public boolean isParameterSetLocally(final 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     public boolean isParameterTrue(final 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     public boolean isParameterFalse(final String name);
230 
231 }