Home | History | Annotate | Download | only in params
      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  * @deprecated Please use {@link java.net.URL#openConnection} instead.
     44  *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
     45  *     for further details.
     46  */
     47 @Deprecated
     48 public interface HttpParams {
     49 
     50     /**
     51      * Obtains the value of the given parameter.
     52      *
     53      * @param name the parent name.
     54      *
     55      * @return  an object that represents the value of the parameter,
     56      *          <code>null</code> if the parameter is not set or if it
     57      *          is explicitly set to <code>null</code>
     58      *
     59      * @see #setParameter(String, Object)
     60      */
     61     Object getParameter(String name);
     62 
     63     /**
     64      * Assigns the value to the parameter with the given name.
     65      *
     66      * @param name parameter name
     67      * @param value parameter value
     68      */
     69     HttpParams setParameter(String name, Object value);
     70 
     71     /**
     72      * Creates a copy of these parameters.
     73      *
     74      * @return  a new set of parameters holding the same values as this one
     75      */
     76     HttpParams copy();
     77 
     78     /**
     79      * Removes the parameter with the specified name.
     80      *
     81      * @param name parameter name
     82      *
     83      * @return true if the parameter existed and has been removed, false else.
     84      */
     85     boolean removeParameter(String name);
     86 
     87     /**
     88      * Returns a {@link Long} parameter value with the given name.
     89      * If the parameter is not explicitly set, the default value is returned.
     90      *
     91      * @param name the parent name.
     92      * @param defaultValue the default value.
     93      *
     94      * @return a {@link Long} that represents the value of the parameter.
     95      *
     96      * @see #setLongParameter(String, long)
     97      */
     98     long getLongParameter(String name, long defaultValue);
     99 
    100     /**
    101      * Assigns a {@link Long} to the parameter with the given name
    102      *
    103      * @param name parameter name
    104      * @param value parameter value
    105      */
    106     HttpParams setLongParameter(String name, long value);
    107 
    108     /**
    109      * Returns an {@link Integer} parameter value with the given name.
    110      * If the parameter is not explicitly set, the default value is returned.
    111      *
    112      * @param name the parent name.
    113      * @param defaultValue the default value.
    114      *
    115      * @return a {@link Integer} that represents the value of the parameter.
    116      *
    117      * @see #setIntParameter(String, int)
    118      */
    119     int getIntParameter(String name, int defaultValue);
    120 
    121     /**
    122      * Assigns an {@link Integer} to the parameter with the given name
    123      *
    124      * @param name parameter name
    125      * @param value parameter value
    126      */
    127     HttpParams setIntParameter(String name, int value);
    128 
    129     /**
    130      * Returns a {@link Double} parameter value with the given name.
    131      * If the parameter is not explicitly set, the default value is returned.
    132      *
    133      * @param name the parent name.
    134      * @param defaultValue the default value.
    135      *
    136      * @return a {@link Double} that represents the value of the parameter.
    137      *
    138      * @see #setDoubleParameter(String, double)
    139      */
    140     double getDoubleParameter(String name, double defaultValue);
    141 
    142     /**
    143      * Assigns a {@link Double} to the parameter with the given name
    144      *
    145      * @param name parameter name
    146      * @param value parameter value
    147      */
    148     HttpParams setDoubleParameter(String name, double value);
    149 
    150     /**
    151      * Returns a {@link Boolean} parameter value with the given name.
    152      * If the parameter is not explicitly set, the default value is returned.
    153      *
    154      * @param name the parent name.
    155      * @param defaultValue the default value.
    156      *
    157      * @return a {@link Boolean} that represents the value of the parameter.
    158      *
    159      * @see #setBooleanParameter(String, boolean)
    160      */
    161     boolean getBooleanParameter(String name, boolean defaultValue);
    162 
    163     /**
    164      * Assigns a {@link Boolean} to the parameter with the given name
    165      *
    166      * @param name parameter name
    167      * @param value parameter value
    168      */
    169     HttpParams setBooleanParameter(String name, boolean value);
    170 
    171     /**
    172      * Checks if a boolean parameter is set to <code>true</code>.
    173      *
    174      * @param name parameter name
    175      *
    176      * @return <tt>true</tt> if the parameter is set to value <tt>true</tt>,
    177      *         <tt>false</tt> if it is not set or set to <code>false</code>
    178      */
    179     boolean isParameterTrue(String name);
    180 
    181     /**
    182      * Checks if a boolean parameter is not set or <code>false</code>.
    183      *
    184      * @param name parameter name
    185      *
    186      * @return <tt>true</tt> if the parameter is either not set or
    187      *         set to value <tt>false</tt>,
    188      *         <tt>false</tt> if it is set to <code>true</code>
    189      */
    190     boolean isParameterFalse(String name);
    191 
    192 }
    193