KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > PropertyValuesEditor


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.beans;
18
19 import java.beans.PropertyEditorSupport JavaDoc;
20 import java.util.Properties JavaDoc;
21
22 import org.springframework.beans.MutablePropertyValues;
23 import org.springframework.beans.propertyeditors.PropertiesEditor;
24
25 /**
26  * Editor for PropertyValues objects. Not
27  * a GUI editor.
28  * <br>NB: this editor must be registered with the JavaBeans API before it
29  * will be available. Editors in this package are
30  * registered by BeanWrapperImpl.
31  * <br>The required format is defined in java.util.Properties documentation.
32  * Each property must be on a new line.
33  * <br>
34  * The present implementation relies on a PropertiesEditor.
35  *
36  * @author Rod Johnson
37  */

38 public class PropertyValuesEditor extends PropertyEditorSupport JavaDoc {
39     
40     
41     /**
42      * @see java.beans.PropertyEditor#setAsText(java.lang.String)
43      */

44     public void setAsText(String JavaDoc s) throws IllegalArgumentException JavaDoc {
45         PropertiesEditor pe = new PropertiesEditor();
46         pe.setAsText(s);
47         Properties JavaDoc props = (Properties JavaDoc) pe.getValue();
48         setValue(new MutablePropertyValues(props));
49     }
50
51 }
52
53
Popular Tags