mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParams.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParams.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,195 @@
     1.4 +/*
     1.5 + * ====================================================================
     1.6 + * Licensed to the Apache Software Foundation (ASF) under one
     1.7 + * or more contributor license agreements.  See the NOTICE file
     1.8 + * distributed with this work for additional information
     1.9 + * regarding copyright ownership.  The ASF licenses this file
    1.10 + * to you under the Apache License, Version 2.0 (the
    1.11 + * "License"); you may not use this file except in compliance
    1.12 + * with the License.  You may obtain a copy of the License at
    1.13 + *
    1.14 + *   http://www.apache.org/licenses/LICENSE-2.0
    1.15 + *
    1.16 + * Unless required by applicable law or agreed to in writing,
    1.17 + * software distributed under the License is distributed on an
    1.18 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    1.19 + * KIND, either express or implied.  See the License for the
    1.20 + * specific language governing permissions and limitations
    1.21 + * under the License.
    1.22 + * ====================================================================
    1.23 + *
    1.24 + * This software consists of voluntary contributions made by many
    1.25 + * individuals on behalf of the Apache Software Foundation.  For more
    1.26 + * information on the Apache Software Foundation, please see
    1.27 + * <http://www.apache.org/>.
    1.28 + *
    1.29 + */
    1.30 +
    1.31 +package ch.boye.httpclientandroidlib.params;
    1.32 +
    1.33 +/**
    1.34 + * HttpParams interface represents a collection of immutable values that define
    1.35 + * a runtime behavior of a component. HTTP parameters should be simple objects:
    1.36 + * integers, doubles, strings, collections and objects that remain immutable
    1.37 + * at runtime. HttpParams is expected to be used in 'write once - read many' mode.
    1.38 + * Once initialized, HTTP parameters are not expected to mutate in
    1.39 + * the course of HTTP message processing.
    1.40 + * <p>
    1.41 + * The purpose of this interface is to define a behavior of other components.
    1.42 + * Usually each complex component has its own HTTP parameter collection.
    1.43 + * <p>
    1.44 + * Instances of this interface can be linked together to form a hierarchy.
    1.45 + * In the simplest form one set of parameters can use content of another one
    1.46 + * to obtain default values of parameters not present in the local set.
    1.47 + *
    1.48 + * @see DefaultedHttpParams
    1.49 + *
    1.50 + * @since 4.0
    1.51 + */
    1.52 +public interface HttpParams {
    1.53 +
    1.54 +    /**
    1.55 +     * Obtains the value of the given parameter.
    1.56 +     *
    1.57 +     * @param name the parent name.
    1.58 +     *
    1.59 +     * @return  an object that represents the value of the parameter,
    1.60 +     *          <code>null</code> if the parameter is not set or if it
    1.61 +     *          is explicitly set to <code>null</code>
    1.62 +     *
    1.63 +     * @see #setParameter(String, Object)
    1.64 +     */
    1.65 +    Object getParameter(String name);
    1.66 +
    1.67 +    /**
    1.68 +     * Assigns the value to the parameter with the given name.
    1.69 +     *
    1.70 +     * @param name parameter name
    1.71 +     * @param value parameter value
    1.72 +     */
    1.73 +    HttpParams setParameter(String name, Object value);
    1.74 +
    1.75 +    /**
    1.76 +     * Creates a copy of these parameters.
    1.77 +     *
    1.78 +     * @return  a new set of parameters holding the same values as this one
    1.79 +     *
    1.80 +     * @deprecated
    1.81 +     */
    1.82 +    HttpParams copy();
    1.83 +
    1.84 +    /**
    1.85 +     * Removes the parameter with the specified name.
    1.86 +     *
    1.87 +     * @param name parameter name
    1.88 +     *
    1.89 +     * @return true if the parameter existed and has been removed, false else.
    1.90 +     */
    1.91 +    boolean removeParameter(String name);
    1.92 +
    1.93 +    /**
    1.94 +     * Returns a {@link Long} parameter value with the given name.
    1.95 +     * If the parameter is not explicitly set, the default value is returned.
    1.96 +     *
    1.97 +     * @param name the parent name.
    1.98 +     * @param defaultValue the default value.
    1.99 +     *
   1.100 +     * @return a {@link Long} that represents the value of the parameter.
   1.101 +     *
   1.102 +     * @see #setLongParameter(String, long)
   1.103 +     */
   1.104 +    long getLongParameter(String name, long defaultValue);
   1.105 +
   1.106 +    /**
   1.107 +     * Assigns a {@link Long} to the parameter with the given name
   1.108 +     *
   1.109 +     * @param name parameter name
   1.110 +     * @param value parameter value
   1.111 +     */
   1.112 +    HttpParams setLongParameter(String name, long value);
   1.113 +
   1.114 +    /**
   1.115 +     * Returns an {@link Integer} parameter value with the given name.
   1.116 +     * If the parameter is not explicitly set, the default value is returned.
   1.117 +     *
   1.118 +     * @param name the parent name.
   1.119 +     * @param defaultValue the default value.
   1.120 +     *
   1.121 +     * @return a {@link Integer} that represents the value of the parameter.
   1.122 +     *
   1.123 +     * @see #setIntParameter(String, int)
   1.124 +     */
   1.125 +    int getIntParameter(String name, int defaultValue);
   1.126 +
   1.127 +    /**
   1.128 +     * Assigns an {@link Integer} to the parameter with the given name
   1.129 +     *
   1.130 +     * @param name parameter name
   1.131 +     * @param value parameter value
   1.132 +     */
   1.133 +    HttpParams setIntParameter(String name, int value);
   1.134 +
   1.135 +    /**
   1.136 +     * Returns a {@link Double} parameter value with the given name.
   1.137 +     * If the parameter is not explicitly set, the default value is returned.
   1.138 +     *
   1.139 +     * @param name the parent name.
   1.140 +     * @param defaultValue the default value.
   1.141 +     *
   1.142 +     * @return a {@link Double} that represents the value of the parameter.
   1.143 +     *
   1.144 +     * @see #setDoubleParameter(String, double)
   1.145 +     */
   1.146 +    double getDoubleParameter(String name, double defaultValue);
   1.147 +
   1.148 +    /**
   1.149 +     * Assigns a {@link Double} to the parameter with the given name
   1.150 +     *
   1.151 +     * @param name parameter name
   1.152 +     * @param value parameter value
   1.153 +     */
   1.154 +    HttpParams setDoubleParameter(String name, double value);
   1.155 +
   1.156 +    /**
   1.157 +     * Returns a {@link Boolean} parameter value with the given name.
   1.158 +     * If the parameter is not explicitly set, the default value is returned.
   1.159 +     *
   1.160 +     * @param name the parent name.
   1.161 +     * @param defaultValue the default value.
   1.162 +     *
   1.163 +     * @return a {@link Boolean} that represents the value of the parameter.
   1.164 +     *
   1.165 +     * @see #setBooleanParameter(String, boolean)
   1.166 +     */
   1.167 +    boolean getBooleanParameter(String name, boolean defaultValue);
   1.168 +
   1.169 +    /**
   1.170 +     * Assigns a {@link Boolean} to the parameter with the given name
   1.171 +     *
   1.172 +     * @param name parameter name
   1.173 +     * @param value parameter value
   1.174 +     */
   1.175 +    HttpParams setBooleanParameter(String name, boolean value);
   1.176 +
   1.177 +    /**
   1.178 +     * Checks if a boolean parameter is set to <code>true</code>.
   1.179 +     *
   1.180 +     * @param name parameter name
   1.181 +     *
   1.182 +     * @return <tt>true</tt> if the parameter is set to value <tt>true</tt>,
   1.183 +     *         <tt>false</tt> if it is not set or set to <code>false</code>
   1.184 +     */
   1.185 +    boolean isParameterTrue(String name);
   1.186 +
   1.187 +    /**
   1.188 +     * Checks if a boolean parameter is not set or <code>false</code>.
   1.189 +     *
   1.190 +     * @param name parameter name
   1.191 +     *
   1.192 +     * @return <tt>true</tt> if the parameter is either not set or
   1.193 +     *         set to value <tt>false</tt>,
   1.194 +     *         <tt>false</tt> if it is set to <code>true</code>
   1.195 +     */
   1.196 +    boolean isParameterFalse(String name);
   1.197 +
   1.198 +}

mercurial