Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7159585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:15:19+00:00 2026-05-28T13:15:19+00:00

I have a Bean that looks like this Class Person{ private String name; private

  • 0

I have a Bean that looks like this

Class Person{
 private String name;
 private int age
 private Properties attributes 
 public String getName() { return name; }
 public int getAge() { return age; }
 public Properties getAttributes () { return attributes; }
 public void setName(String name) { this.name=name; }
 public void setAge(int age) { this.age=age; }
 public void setAttributes (Properties attributes) { this.attributes = attributes; }
}

Trying to use Vaadin Forms to allow the editing of the Bean, i assign the Bean to the form using

form.setItemDataSource(new BeanItem<Person>(person));

The form displays correct with the attributes showing “{eye.colour=green,hair.colour=brown}”
But when trying to commit any changes, a Conversion error is thrown in regards to Properties.< Init > not having a string constructor.

How can Vaadin Forms handle Beans with non primitive types properties ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:15:20+00:00Added an answer on May 28, 2026 at 1:15 pm

    You’ll have to create a custom fieldfactory for the form by extending DefaultFieldFactory.

    See https://vaadin.com/book/-/page/components.form.html (half way through the page on how to do this). This will allow you to override the default way form fields are generated. This however doesn’t provide an easy way to handle custom fields and conversions like you want.

    Luckily though there is a good extension, which I use, to easily create custom fields and property conversions named the custom field plugin.

    https://vaadin.com/directory#addon/customfield

    With this component you can easily extend existing fields and add custom conversions.

    Since there aren’t many examples on how to do this out there, here is an example of how the various parts of a custom FieldFactory with a custom field work together.

    public class CustomFieldFactory extends DefaultFieldFactory {

    public DefaultProfileTableFieldFactory() {
    }
    
    @Override
    public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {
    
        if (propertyId.equals(YOURCUSTOMPROP)) {
            Select select = new Select();
            select.addItem(ITEM1);
            select.addItem(ITEM2);
            select.addItem(ITEM3);
    
            return new SelectCustomField(select, String.class);
        } else {
            return super.createField(container, itemId, propertyId, uiContext);
        }
    }
    
    
    private static class SelectCustomField extends FieldWrapper<String> {
    
        protected SelectCustomField(Field wrappedField, Class<? extends String> propertyType) {
            super(wrappedField, propertyType);
            VerticalLayout l = new VerticalLayout();
            l.addComponent(wrappedField);
            setCompositionRoot(l);
            l.setSizeUndefined();
            this.setSizeUndefined();
            wrappedField.setSizeUndefined();
        }
    
        @Override
        protected String parse(Object value) throws ConversionException {
            // parse value from select to your model
        }
    
        @Override
        protected Object format(String value) {
            // format model from your model to value to be shown        
        }
    
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that looks like this: public class Person { public class
Let's say I have a class Person with properties name and age , and
Assuming that I have a CronTriggerBean similar to <bean id=midMonthCronTrigger class=org.springframework.scheduling.quartz.CronTriggerBean> <property name=jobDetail ref=reminderJobDetail
Suppose that I have a database query which looks like below - select name,
In my Spring context file I have something like this: <bean id=userCheck class=a.b.c.UserExistsCheck/> <aop:config>
I have main page that looks like this: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html
I have a MDB (Message driven bean) that receives messages with String which represent
We have a Hibernate/Spring application that have the following Spring beans: <bean id=transactionManager class=org.springframework.orm.hibernate3.HibernateTransactionManager
Imagine that i have the following code: <a:repeat value=#{bean.getList()} var=x > <li class=la> <span>
I have a dataTable which has a value of a bean class which looks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.