View Javadoc

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