Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeanProperties.java should not be using getDeclaredFields() #63

Open
aner-perez opened this issue Sep 10, 2015 · 0 comments
Open

BeanProperties.java should not be using getDeclaredFields() #63

aner-perez opened this issue Sep 10, 2015 · 0 comments

Comments

@aner-perez
Copy link

BeanProperties.java uses getDeclaredFields() to iterate over properties in a bean but not all properties on a bean need to have a corresponding field on the class. This causes unwarranted CsvExceptions to be thrown claiming "Property does not exist".

A bean can have many properties which have no corresponding field on the class.

For example:

class A {
    String[] values = new String[2];
    public void setName(String name) {
        values[0] = name;
    }
    public void getName() {
        return values[0];
    }
    public void setLogin(String login) {
        values[1] = login;
    }
    public void getLogin() {
        return values[1];
    }
}

This class would have 1 field called "values" but 2 properties called "name" and "login"

Record classes generated by JOOQ are a real-world example of this pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant