vaadin / serverside-elements

Vaadin add-on that makes it easy to use Web Components or any HTML elements from Vaadin Framework
https://vaadin.com/addon/elements-add-on
Apache License 2.0
14 stars 12 forks source link

Can't access hyphenated properties #10

Closed TheSalsaest closed 7 years ago

TheSalsaest commented 7 years ago

Given the actual logic of ElementReflectHelper.getPropertyName, accessing hyphenated properties (such as 'auto-validate' is impossible.

One possible way to do so would be rewriting the method in the following fashion:

    public static String getPropertyName(String name)
    {

    name = name.replaceAll("^(get|set|is)", "");
    // TODO locale for lower case
    name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
    name = name.replaceAll("([A-Z])", "-$1").toLowerCase();
    return name;
    }