Results 1 to 4 of 4

Thread: still no char property setting?

  1. #1
    Join Date
    Nov 2004
    Posts
    9

    Default still no char property setting?

    I'm getting a :
    Failed to convert property value of type [java.lang.String] to required type [char]
    when trying to set a char property.
    Is there a workaround to solve this?
    Will it be possible in future releases?

    Please also respond if there's no solution, there's a unanswered question about this since 02 february 05.

    Bart

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Bart,

    You can create your own property editor and plug it into the container if you want to be able to configure char properties using Spring.

    See section 3.13 of the reference guide for more details.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  3. #3
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    Unfortunately, the JDK's JavaBeans machinery does not have a default PropertyEditor for chars. I'll add a CharacterEditor to Spring and register it by default for properties of type char and java.lang.Character; this will be part of 1.2 RC2.

    Juergen

  4. #4
    Join Date
    Nov 2004
    Posts
    9

    Default

    I've tried the PropertyEditorSupport, but it did not work for a char.

    Did something like this :

    public class StringToCharEditor extends PropertyEditorSupport{
    public void setAsText(String text) {
    setValue(new Character(text.charAt(0)));
    }
    }

    can't remember the correct error but I think it was the conversion of Character to char that went wrong.

    We will wait till next release.

    As a workaround I wrapped the "bean" and provided setters with a String.

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 4
    Last Post: Aug 17th, 2005, 04:42 AM
  5. Replies: 2
    Last Post: May 13th, 2005, 05:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •