/**
 *        Licensed to the Apache Software Foundation (ASF) under one
 *        or more contributor license agreements.  See the NOTICE file
 *        distributed with this work for additional information
 *        regarding copyright ownership.  The ASF licenses this file
 *        to you under the Apache License, Version 2.0 (the
 *        "License"); you may not use this file except in compliance
 *        with the License.  You may obtain a copy of the License at
 *
 *          http://www.apache.org/licenses/LICENSE-2.0
 *
 *        Unless required by applicable law or agreed to in writing,
 *        software distributed under the License is distributed on an
 *        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *        KIND, either express or implied.  See the License for the
 *        specific language governing permissions and limitations
 *        under the License.
 *
 */
/*
    Copyright 2010, Strategic Gains, Inc.

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
 */
package org.restexpress.url;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

/**
 * Contains the results of a UrlPattern.match() call, reflecting the match
 * outcome and containing any parameter values, if applicable.
 * 
 * <p/>
 * UrlMatch is immutable.
 * 
 * @author toddf
 * @since Apr 29, 2010
 */
public class UrlMatch {
	/**
	 * Parameter values parsed from the URL during the match.
	 */
	private final Map<String, String> parameters = new HashMap<String, String>();

	// SECTION: CONSTRUCTOR

	public UrlMatch(final Map<String, String> parameters) {
		super();

		if (parameters != null) {
			this.parameters.putAll(parameters);
		}
	}

	// SECTION: ACCESSORS

	/**
	 * Retrieves a parameter value parsed from the URL during the match.
	 * 
	 * @param name
	 *            the name of a parameter for which to retrieve the value.
	 * @return the parameter value from the URL, or null if not present.
	 */
	public String get(final String name) {
		return parameters.get(name);
	}

	/**
	 * Retrieves the parameter entries as a set.
	 * 
	 * @return a Set of Map entries (by String, String).
	 */
	public Set<Entry<String, String>> parameterSet() {
		return Collections.unmodifiableSet(parameters.entrySet());
	}
}

@@ -906,19 +906,16 @@
 %0A */%0A/*%0A
-   
  Copyrig
@@ -946,17 +946,17 @@
 , Inc.%0A%0A
-%09
+ 
 Licensed
@@ -1011,17 +1011,17 @@
 ense%22);%0A
-%09
+ 
 you may 
@@ -1077,17 +1077,17 @@
 icense.%0A
-%09
+ 
 You may 
@@ -1119,18 +1119,17 @@
 nse at%0A%0A
-%09%09
+ 
 http://w
@@ -1164,17 +1164,17 @@
 SE-2.0%0A%0A
-%09
+ 
 Unless r
@@ -1233,17 +1233,17 @@
 oftware%0A
-%09
+ 
 distribu
@@ -1300,17 +1300,17 @@
  BASIS,%0A
-%09
+ 
 WITHOUT 
@@ -1374,17 +1374,17 @@
 mplied.%0A
-%09
+ 
 See the 
@@ -1443,17 +1443,17 @@
 ons and%0A
-%09
+ 
 limitati
@@ -1543,34 +1543,8 @@
 ns;%0A
-import java.util.HashMap;%0A
 impo
@@ -1612,16 +1612,56 @@
 l.Set;%0A%0A
+import com.google.common.collect.Maps;%0A%0A
 /**%0A * C
@@ -1730,19 +1730,16 @@
 he match
-%0A *
  outcome
@@ -1884,16 +1884,22 @@
 %0Apublic 
+final 
 class Ur
@@ -1907,22 +1907,28 @@
 Match %7B%0A
-%09/**%0A%09
+    /**%0A    
  * Param
@@ -1977,22 +1977,28 @@
  match.%0A
-%09 */%0A%09
+     */%0A    
 private 
@@ -2040,67 +2040,32 @@
 s = 
+Maps.
 new
- 
 HashMap
-%3CString, String%3E();%0A%0A%09// SECTION: CONSTRUCTOR%0A%0A%09
+();%0A%0A    
 publ
@@ -2116,18 +2116,24 @@
 ters) %7B%0A
-%09%09
+        
 super();
@@ -2133,19 +2133,24 @@
 uper();%0A
-%0A%09%09
+        
 if (para
@@ -2171,11 +2171,20 @@
 ) %7B%0A
-%09%09%09
+            
 this
@@ -2219,46 +2219,37 @@
 s);%0A
-%09%09%7D%0A%09%7D%0A%0A%09// SECTION: ACCESSORS%0A%0A%09/**%0A%09
+        %7D%0A    %7D%0A%0A    /**%0A    
  * R
@@ -2313,22 +2313,28 @@
  match.%0A
-%09 * %0A%09
+     * %0A    
  * @para
@@ -2343,23 +2343,8 @@
 name
-%0A%09 *           
  the
@@ -2397,17 +2397,20 @@
  value.%0A
-%09
+    
  * @retu
@@ -2470,22 +2470,28 @@
 resent.%0A
-%09 */%0A%09
+     */%0A    
 public S
@@ -2517,26 +2517,32 @@
 ing name) %7B%0A
-%09%09
+        
 return param
@@ -2562,18 +2562,27 @@
 e);%0A
-%09%7D%0A%0A%09/**%0A%09
+    %7D%0A%0A    /**%0A    
  * R
@@ -2626,14 +2626,20 @@
 et.%0A
-%09 * %0A%09
+     * %0A    
  * @
@@ -2691,14 +2691,20 @@
 g).%0A
-%09 */%0A%09
+     */%0A    
 publ
@@ -2754,10 +2754,16 @@
 ) %7B%0A
-%09%09
+        
 retu
@@ -2821,9 +2821,12 @@
 ));%0A
-%09
+    
 %7D%0A%7D%0A

add final