View Javadoc

    1   package org.apache.turbine.util.uri;
    2
    3
    4   /*
    5    * Licensed to the Apache Software Foundation (ASF) under one
    6    * or more contributor license agreements.  See the NOTICE file
    7    * distributed with this work for additional information
    8    * regarding copyright ownership.  The ASF licenses this file
    9    * to you under the Apache License, Version 2.0 (the
    10   * "License"); you may not use this file except in compliance
    11   * with the License.  You may obtain a copy of the License at
    12   *
    13   *   http://www.apache.org/licenses/LICENSE-2.0
    14   *
    15   * Unless required by applicable law or agreed to in writing,
    16   * software distributed under the License is distributed on an
    17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    18   * KIND, either express or implied.  See the License for the
    19   * specific language governing permissions and limitations
    20   * under the License.
    21   */
    22
    23
    24  import org.apache.commons.lang.StringUtils;
    25
    26  /**
    27   * Helper Class to keep a key and a value together in
    28   * one object. Used for URI Parameters
    29   *
    30   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
    31   * @version $Id: URIParam.java 615328 2008-01-25 20:25:05Z tv $
    32   */
    33
    34  public class URIParam
    35  {
    36      /** Key */
    37      private String key = null;
    38
    39      /** Value */
    40      private Object value = null;
    41
    42      /**
    43       * Creates a new Object from Key and Value
    44       *
    45       * @param key A String with the Param Name.
    46       * @param value An Object with the Value.
    47       *
    48       */
    49      public URIParam(String key, Object value)
    50      {
    51          this.key = key;
    52          this.value = value;
    53      }
    54
    55      /**
    56       * Returns the key.
    57       *
    58       * @return The key value.
    59       *
    60       */
    61      public String getKey()
    62      {
    63          return (StringUtils.isNotEmpty(key)) ? key : "";
    64      }
    65
    66      /**
    67       * Returns the value.
    68       *
    69       * @return The value of this object.
    70       *
    71       */
    72      public Object getValue()
    73      {
    74          return value;
    75      }
    76  }