001: /*
002: * $HeadURL: https://svn.apache.org/repos/asf/httpcomponents/httpcore/tags/4.0-beta1/module-main/src/main/java/org/apache/http/params/HttpParams.java $
003: * $Revision: 610763 $
004: * $Date: 2008-01-10 13:01:13 +0100 (Thu, 10 Jan 2008) $
005: *
006: * ====================================================================
007: * Licensed to the Apache Software Foundation (ASF) under one
008: * or more contributor license agreements. See the NOTICE file
009: * distributed with this work for additional information
010: * regarding copyright ownership. The ASF licenses this file
011: * to you under the Apache License, Version 2.0 (the
012: * "License"); you may not use this file except in compliance
013: * with 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,
018: * software distributed under the License is distributed on an
019: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
020: * KIND, either express or implied. See the License for the
021: * specific language governing permissions and limitations
022: * under the License.
023: * ====================================================================
024: *
025: * This software consists of voluntary contributions made by many
026: * individuals on behalf of the Apache Software Foundation. For more
027: * information on the Apache Software Foundation, please see
028: * <http://www.apache.org/>.
029: *
030: */
031:
032: package org.apache.http.params;
033:
034: /**
035: * Represents a collection of HTTP protocol and framework parameters.
036: *
037: * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
038: *
039: * @version $Revision: 610763 $
040: *
041: * @since 4.0
042: */
043: public interface HttpParams {
044:
045: /**
046: * Obtains the value of the given parameter.
047: *
048: * @param name the parent name.
049: *
050: * @return an object that represents the value of the parameter,
051: * <code>null</code> if the parameter is not set or if it
052: * is explicitly set to <code>null</code>
053: *
054: * @see #setParameter(String, Object)
055: */
056: Object getParameter(String name);
057:
058: /**
059: * Assigns the value to the parameter with the given name.
060: *
061: * @param name parameter name
062: * @param value parameter value
063: */
064: HttpParams setParameter(String name, Object value);
065:
066: /**
067: * Creates a copy of these parameters.
068: *
069: * @return a new set of parameters holding the same values as this one
070: */
071: HttpParams copy();
072:
073: /**
074: * Removes the parameter with the specified name.
075: *
076: * @param name parameter name
077: *
078: * @return true if the parameter existed and has been removed, false else.
079: */
080: boolean removeParameter(String name);
081:
082: /**
083: * Returns a {@link Long} parameter value with the given name.
084: * If the parameter is not explicitly set, the default value is returned.
085: *
086: * @param name the parent name.
087: * @param defaultValue the default value.
088: *
089: * @return a {@link Long} that represents the value of the parameter.
090: *
091: * @see #setLongParameter(String, long)
092: */
093: long getLongParameter(String name, long defaultValue);
094:
095: /**
096: * Assigns a {@link Long} to the parameter with the given name
097: *
098: * @param name parameter name
099: * @param value parameter value
100: */
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: */
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: */
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: */
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: */
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: */
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: */
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: */
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: */
185: boolean isParameterFalse(String name);
186:
187: }
|