Announcement Announcement Module
No announcement yet.
PropertyEditor not for Type conversion but String manipulation ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • PropertyEditor not for Type conversion but String manipulation ?


    I'm feeling kinda lost when it comes to String type with Property editors and string transformation. PropertyEditors and Conversion services are based on type of properties. But what about when it is needed to transform string to a different string ? If the field is of Date type, CustomDatePropertyEditor is applied, the conversion will be always the same, String to Date, but if we want to convert string A to string B, then we want it to happen only to a particular field, but it would do that for all fields of type String. There is no way of saying which field to convert / transform by this PropertyEditor.

    For instance, I'm getting 1 or 0 request parameters from a UI html form widget and I'd need to bind it to a bean as PM or AM. How would I do that ?

  • #2
    I overlooked this method in DataBinder.

    public void registerCustomEditor(Class requiredType, String field, PropertyEditor propertyEditor)