/*
 * Copyright 2002-2005 the original author or authors.
 * 
 * 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.springframework.beans;

import java.beans.PropertyEditorSupport;
import java.util.Properties;

import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.propertyeditors.PropertiesEditor;

/**
 * Editor for PropertyValues objects. Not
 * a GUI editor.
 * <br>NB: this editor must be registered with the JavaBeans API before it
 * will be available. Editors in this package are
 * registered by BeanWrapperImpl.
 * <br>The required format is defined in java.util.Properties documentation.
 * Each property must be on a new line.
 * <br>
 * The present implementation relies on a PropertiesEditor.
 *
 * @author Rod Johnson
 */
public class PropertyValuesEditor extends PropertyEditorSupport {
	
	
	/**
	 * @see java.beans.PropertyEditor#setAsText(java.lang.String)
	 */
	public void setAsText(String s) throws IllegalArgumentException {
		PropertiesEditor pe = new PropertiesEditor();
		pe.setAsText(s);
		Properties props = (Properties) pe.getValue();
		setValue(new MutablePropertyValues(props));
	}

}


@@ -21,9 +21,9 @@
 -200
-5
+7
  the
@@ -53,17 +53,16 @@
 hors.%0A *
- 
 %0A * Lice
@@ -234,17 +234,16 @@
 se at%0A *
- 
 %0A *     
@@ -288,17 +288,16 @@
 E-2.0%0A *
- 
 %0A * Unle
@@ -726,64 +726,8 @@
 s;%0A%0A
-import org.springframework.beans.MutablePropertyValues;%0A
 impo
@@ -801,229 +801,94 @@
 %0A * 
-Editor for PropertyValues objects. Not%0A * a GUI editor.%0A * %3Cbr%3ENB: this editor must be registered with the JavaBeans API before it%0A * will be available. Editors in this package are%0A * registered by BeanWrapperImpl.
+%7B@link java.beans.PropertyEditor Editor%7D for a %7B@link PropertyValues%7D object.%0A *
 %0A * %3C
-br
+p
 %3EThe
@@ -918,16 +918,27 @@
 ined in 
+the %7B@link 
 java.uti
@@ -949,16 +949,20 @@
 operties
+%7D%0A *
  documen
@@ -968,19 +968,16 @@
 ntation.
-%0A *
  Each pr
@@ -1012,17 +1012,15 @@
 .%0A *
- %3Cbr%3E
 %0A * 
+%3Cp%3E
 The 
@@ -1053,17 +1053,69 @@
 ies on a
- 
+%0A * %7B@link org.springframework.beans.propertyeditors.
 Properti
@@ -1122,16 +1122,31 @@
 esEditor
+%7D%0A * underneath
 .%0A *%0A * 
@@ -1165,16 +1165,43 @@
 Johnson%0A
+ * @author Juergen Hoeller%0A
  */%0Apubl
@@ -1266,84 +1266,84 @@
 t %7B%0A
-%09
 %0A%09
-%0A%09/**%0A%09 * @see java.beans.
+private final 
 Propert
-y
+ies
 Editor
-#setAsText(java.lang.String)%0A%09 */
+ propertiesEditor = new PropertiesEditor();%0A
 %0A%09pu
@@ -1369,17 +1369,20 @@
 (String 
-s
+text
 ) throws
@@ -1415,35 +1415,14 @@
 %7B%0A%09%09
-PropertiesEditor pe = new P
+this.p
 rope
@@ -1436,16 +1436,8 @@
 itor
-();%0A%09%09pe
 .set
@@ -1443,17 +1443,20 @@
 tAsText(
-s
+text
 );%0A%09%09Pro
@@ -1484,18 +1484,37 @@
 erties) 
-pe
+this.propertiesEditor
 .getValu

use a shared PropertiesEditor instance