HttpParams xref

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: 480424 $
    4    * $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $
    5    *
    6    * ====================================================================
    7    *
    8    *  Licensed to the Apache Software Foundation (ASF) under one or more
    9    *  contributor license agreements.  See the NOTICE file distributed with
    10   *  this work for additional information regarding copyright ownership.
    11   *  The ASF licenses this file to You under the Apache License, Version 2.0
    12   *  (the "License"); you may not use this file except in compliance with
    13   *  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, software
    18   *  distributed under the License is distributed on an "AS IS" BASIS,
    19   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    20   *  See the License for the specific language governing permissions and
    21   *  limitations under the License.
    22   * ====================================================================
    23   *
    24   * This software consists of voluntary contributions made by many
    25   * individuals on behalf of the Apache Software Foundation.  For more
    26   * information on the Apache Software Foundation, please see
    27   * <http://www.apache.org/>.
    28   *
    29   */
    30
    31  package org.apache.commons.httpclient.params;
    32
    33  /**
    34   * This interface represents a collection of HTTP protocol parameters. Protocol parameters
    35   * may be linked together to form a hierarchy. If a particular parameter value has not been
    36   * explicitly defined in the collection itself, its value will be drawn from the parent
    37   * collection of parameters.
    38   *
    39   * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
    40   *
    41   * @version $Revision: 480424 $
    42   *
    43   * @since 3.0
    44   */
    45  public interface HttpParams {
    46
    47      /**
    48       * Returns the parent collection that this collection will defer to
    49       * for a default value if a particular parameter is not explicitly
    50       * set in the collection itself
    51       *
    52       * @return the parent collection to defer to, if a particular parameter
    53       * is not explictly set in the collection itself.
    54       *
    55       * @see #setDefaults(HttpParams)
    56       */
    57      public HttpParams getDefaults();
    58
    59      /**
    60       * Assigns the parent collection that this collection will defer to
    61       * for a default value if a particular parameter is not explicitly
    62       * set in the collection itself
    63       *
    64       * @param params the parent collection to defer to, if a particular
    65       * parameter is not explictly set in the collection itself.
    66       *
    67       * @see #getDefaults()
    68       */
    69      public void setDefaults(final HttpParams params);
    70
    71      /**
    72       * Returns a parameter value with the given name. If the parameter is
    73       * not explicitly defined in this collection, its value will be drawn
    74       * from a higer level collection at which this parameter is defined.
    75       * If the parameter is not explicitly set anywhere up the hierarchy,
    76       * <tt>null</tt> value is returned.
    77       *
    78       * @param name the parent name.
    79       *
    80       * @return an object that represents the value of the parameter.
    81       *
    82       * @see #setParameter(String, Object)
    83       */
    84      public Object getParameter(final String name);
    85
    86      /**
    87       * Assigns the value to the parameter with the given name
    88       *
    89       * @param name parameter name
    90       * @param value parameter value
    91       */
    92      public void setParameter(final String name, final Object value);
    93
    94      /**
    95       * Returns a {@link Long} parameter value with the given name.
    96       * If the parameter is not explicitly defined in this collection, its
    97       * value will be drawn from a higer level collection at which this parameter
    98       * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
    99       * 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, double defaultValue);
    157
    158     /**
    159      * Assigns a {@link Double} to the parameter with the given name
    160      *
    161      * @param name parameter name
    162      * @param value parameter value
    163      */
    164     public void setDoubleParameter(final String name, double value);
    165
    166     /**
    167      * Returns a {@link Boolean} parameter value with the given name.
    168      * If the parameter is not explicitly defined in this collection, its
    169      * value will be drawn from a higer level collection at which this parameter
    170      * is defined. If the parameter is not explicitly set anywhere up the hierarchy,
    171      * the default value is returned.
    172      *
    173      * @param name the parent name.
    174      * @param defaultValue the default value.
    175      *
    176      * @return a {@link Boolean} that represents the value of the parameter.
    177      *
    178      * @see #setBooleanParameter(String, boolean)
    179      */
    180     public boolean getBooleanParameter(final String name, boolean defaultValue);
    181
    182     /**
    183      * Assigns a {@link Boolean} to the parameter with the given name
    184      *
    185      * @param name parameter name
    186      * @param value parameter value
    187      */
    188     public void setBooleanParameter(final String name, boolean value);
    189
    190     /**
    191      * Returns <tt>true</tt> if the parameter is set at any level, <tt>false</tt> otherwise.
    192      *
    193      * @param name parameter name
    194      *
    195      * @return <tt>true</tt> if the parameter is set at any level, <tt>false</tt>
    196      * otherwise.
    197      */
    198     public boolean isParameterSet(final String name);
    199
    200     /**
    201      * Returns <tt>true</tt> if the parameter is set locally, <tt>false</tt> otherwise.
    202      *
    203      * @param name parameter name
    204      *
    205      * @return <tt>true</tt> if the parameter is set locally, <tt>false</tt>
    206      * otherwise.
    207      */
    208     public boolean isParameterSetLocally(final String name);
    209
    210     /**
    211      * Returns <tt>true</tt> if the parameter is set and is <tt>true</tt>, <tt>false</tt>
    212      * otherwise.
    213      *
    214      * @param name parameter name
    215      *
    216      * @return <tt>true</tt> if the parameter is set and is <tt>true</tt>, <tt>false</tt>
    217      * otherwise.
    218      */
    219     public boolean isParameterTrue(final String name);
    220
    221     /**
    222      * Returns <tt>true</tt> if the parameter is either not set or is <tt>false</tt>,
    223      * <tt>false</tt> otherwise.
    224      *
    225      * @param name parameter name
    226      *
    227      * @return <tt>true</tt> if the parameter is either not set or is <tt>false</tt>,
    228      * <tt>false</tt> otherwise.
    229      */
    230     public boolean isParameterFalse(final String name);
    231
    232 }