001 /*
002 * Copyright 1999-2002,2004 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.apache.commons.latka.http;
018
019 import java.util.LinkedList;
020 import java.util.List;
021
022 /**
023 * An implementation of the {@link Parameters} interface that stores the
024 * name value pairs as a list of two element string arrays
025 *
026 * @see Parameters
027 * @author Morgan Delagrange
028 * @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
029 * @version $Id: ParametersImpl.java 155424 2005-02-26 13:09:29Z dirkv $
030 */
031 public class ParametersImpl implements Parameters {
032
033 /**
034 * List of parameters. Each element of the list is a String[] with first
035 * element parameter name, second element parameter value
036 */
037 protected List _list = new LinkedList();
038
039 /**
040 * Protected access, parameters can only be copied from
041 * request to request.
042 */
043 protected ParametersImpl() {
044 }
045
046 /**
047 * Defined in interface
048 * @see Parameters#addParameter(String,String)
049 */
050 public void addParameter(String paramName, String paramValue) {
051 _list.add(new String[] { paramName, paramValue });
052 }
053
054 /**
055 * Defined in interface
056 * @see Parameters#getParameters()
057 * @return list of parameters
058 */
059 public List getParameters() {
060 return _list;
061 }
062 }