Announcement Announcement Module
Collapse
No announcement yet.
still no char property setting? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment


      • #4
        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.

        Comment

        Working...
        X