geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r421909 - in /geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl: FileEditor.java PropertyEditorHelper.java
Date Fri, 14 Jul 2006 13:53:14 GMT
Author: jstrachan
Date: Fri Jul 14 06:53:13 2006
New Revision: 421909

URL: http://svn.apache.org/viewvc?rev=421909&view=rev
Log:
Added a file editor to work around bugs caused by spring 2.0-rc1 or later no longer allowing
auto-mutation of Strings to Files

Added:
    geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java
  (with props)
Modified:
    geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java

Added: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java?rev=421909&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java
(added)
+++ geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java
Fri Jul 14 06:53:13 2006
@@ -0,0 +1,37 @@
+/**
+ * 
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,  as applicable.
+ * 
+ * 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.apache.xbean.spring.context.impl;
+
+import java.beans.PropertyEditorSupport;
+import java.io.File;
+
+/**
+ * Editor for <code>java.io.File</code>
+ */
+public class FileEditor extends PropertyEditorSupport {
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue(new File(text));
+    }
+
+    public String getAsText() {
+        File value = (File) getValue();
+        return (value != null ? value.toString() : "");
+    }
+
+}

Propchange: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/FileEditor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java?rev=421909&r1=421908&r2=421909&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
(original)
+++ geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
Fri Jul 14 06:53:13 2006
@@ -31,6 +31,7 @@
     private static final Log log = LogFactory.getLog(PropertyEditorHelper.class);
 
     public static void registerCustomEditors() {
+        registerEditor("java.io.File", "org.apache.xbean.spring.context.impl.FileEditor");
         registerEditor("java.net.URI", "org.apache.xbean.spring.context.impl.URIEditor");
         registerEditor("javax.management.ObjectName", "org.apache.xbean.spring.context.impl.ObjectNameEditor");
     }



Mime
View raw message