001: /*
002: * $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 $
003: * $Revision: 480424 $
004: * $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $
005: *
006: * ====================================================================
007: *
008: * Licensed to the Apache Software Foundation (ASF) under one or more
009: * contributor license agreements. See the NOTICE file distributed with
010: * this work for additional information regarding copyright ownership.
011: * The ASF licenses this file to You under the Apache License, Version 2.0
012: * (the "License"); you may not use this file except in compliance with
013: * the License. You may obtain a copy of the License at
014: *
015: * http://www.apache.org/licenses/LICENSE-2.0
016: *
017: * Unless required by applicable law or agreed to in writing, software
018: * distributed under the License is distributed on an "AS IS" BASIS,
019: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020: * See the License for the specific language governing permissions and
021: * limitations under the License.
022: * ====================================================================
023: *
024: * This software consists of voluntary contributions made by many
025: * individuals on behalf of the Apache Software Foundation. For more
026: * information on the Apache Software Foundation, please see
027: * <http://www.apache.org/>.
028: *
029: */
030:
031: package org.apache.commons.httpclient.params;
032:
033: /**
034: * This interface represents a collection of HTTP protocol parameters. Protocol parameters
035: * may be linked together to form a hierarchy. If a particular parameter value has not been
036: * explicitly defined in the collection itself, its value will be drawn from the parent
037: * collection of parameters.
038: *
039: * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
040: *
041: * @version $Revision: 480424 $
042: *
043: * @since 3.0
044: */
045: public interface HttpParams {
046:
047: /**
048: * Returns the parent collection that this collection will defer to
049: * for a default value if a particular parameter is not explicitly
050: * set in the collection itself
051: *
052: * @return the parent collection to defer to, if a particular parameter
053: * is not explictly set in the collection itself.
054: *
055: * @see #setDefaults(HttpParams)
056: */
057: public HttpParams getDefaults();
058:
059: /**
060: * Assigns the parent collection that this collection will defer to
061: * for a default value if a particular parameter is not explicitly
062: * set in the collection itself
063: *
064: * @param params the parent collection to defer to, if a particular
065: * parameter is not explictly set in the collection itself.
066: *
067: * @see #getDefaults()
068: */
069: public void setDefaults(final HttpParams params);
070:
071: /**
072: * Returns a parameter value with the given name. If the parameter is
073: * not explicitly defined in this collection, its value will be drawn
074: * from a higer level collection at which this parameter is defined.
075: * If the parameter is not explicitly set anywhere up the hierarchy,
076: * <tt>null</tt> value is returned.
077: *
078: * @param name the parent name.
079: *
080: * @return an object that represents the value of the parameter.
081: *
082: * @see #setParameter(String, Object)
083: */
084: public Object getParameter(final String name);
085:
086: /**
087: * Assigns the value to the parameter with the given name
088: *
089: * @param name parameter name
090: * @param value parameter value
091: */
092: public void setParameter(final String name, final Object value);
093:
094: /**
095: * Returns a {@link Long} parameter value with the given name.
096: * If the parameter is not explicitly defined in this collection, its
097: * value will be drawn from a higer level collection at which this parameter
098: * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
099: * the default value is returned.
100: *
101: * @param name the parent name.
102: * @param defaultValue the default value.
103: *
104: * @return a {@link Long} that represents the value of the parameter.
105: *
106: * @see #setLongParameter(String, long)
107: */
108: public long getLongParameter(final String name, long defaultValue);
109:
110: /**
111: * Assigns a {@link Long} to the parameter with the given name
112: *
113: * @param name parameter name
114: * @param value parameter value
115: */
116: public void setLongParameter(final String name, long value);
117:
118: /**
119: * Returns an {@link Integer} parameter value with the given name.
120: * If the parameter is not explicitly defined in this collection, its
121: * value will be drawn from a higer level collection at which this parameter
122: * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
123: * the default value is returned.
124: *
125: * @param name the parent name.
126: * @param defaultValue the default value.
127: *
128: * @return a {@link Integer} that represents the value of the parameter.
129: *
130: * @see #setIntParameter(String, int)
131: */
132: public int getIntParameter(final String name, int defaultValue);
133:
134: /**
135: * Assigns an {@link Integer} to the parameter with the given name
136: *
137: * @param name parameter name
138: * @param value parameter value
139: */
140: public void setIntParameter(final String name, int value);
141:
142: /**
143: * Returns a {@link Double} parameter value with the given name.
144: * If the parameter is not explicitly defined in this collection, its
145: * value will be drawn from a higer level collection at which this parameter
146: * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
147: * the default value is returned.
148: *
149: * @param name the parent name.
150: * @param defaultValue the default value.
151: *
152: * @return a {@link Double} that represents the value of the parameter.
153: *
154: * @see #setDoubleParameter(String, double)
155: */
156: public double getDoubleParameter(final String name,
157: double defaultValue);
158:
159: /**
160: * Assigns a {@link Double} to the parameter with the given name
161: *
162: * @param name parameter name
163: * @param value parameter value
164: */
165: public void setDoubleParameter(final String name, double value);
166:
167: /**
168: * Returns a {@link Boolean} parameter value with the given name.
169: * If the parameter is not explicitly defined in this collection, its
170: * value will be drawn from a higer level collection at which this parameter
171: * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
172: * the default value is returned.
173: *
174: * @param name the parent name.
175: * @param defaultValue the default value.
176: *
177: * @return a {@link Boolean} that represents the value of the parameter.
178: *
179: * @see #setBooleanParameter(String, boolean)
180: */
181: public boolean getBooleanParameter(final String name,
182: boolean defaultValue);
183:
184: /**
185: * Assigns a {@link Boolean} to the parameter with the given name
186: *
187: * @param name parameter name
188: * @param value parameter value
189: */
190: public void setBooleanParameter(final String name, boolean value);
191:
192: /**
193: * Returns <tt>true</tt> if the parameter is set at any level, <tt>false</tt> otherwise.
194: *
195: * @param name parameter name
196: *
197: * @return <tt>true</tt> if the parameter is set at any level, <tt>false</tt>
198: * otherwise.
199: */
200: public boolean isParameterSet(final String name);
201:
202: /**
203: * Returns <tt>true</tt> if the parameter is set locally, <tt>false</tt> otherwise.
204: *
205: * @param name parameter name
206: *
207: * @return <tt>true</tt> if the parameter is set locally, <tt>false</tt>
208: * otherwise.
209: */
210: public boolean isParameterSetLocally(final String name);
211:
212: /**
213: * Returns <tt>true</tt> if the parameter is set and is <tt>true</tt>, <tt>false</tt>
214: * otherwise.
215: *
216: * @param name parameter name
217: *
218: * @return <tt>true</tt> if the parameter is set and is <tt>true</tt>, <tt>false</tt>
219: * otherwise.
220: */
221: public boolean isParameterTrue(final String name);
222:
223: /**
224: * Returns <tt>true</tt> if the parameter is either not set or is <tt>false</tt>,
225: * <tt>false</tt> otherwise.
226: *
227: * @param name parameter name
228: *
229: * @return <tt>true</tt> if the parameter is either not set or is <tt>false</tt>,
230: * <tt>false</tt> otherwise.
231: */
232: public boolean isParameterFalse(final String name);
233:
234: }
|