Skip to content

Any appearance of "get" in property name is replaced with empty string #61

@pareshd

Description

@pareshd

Thank you for creating and maintaining this extremely useful library.
I have run into the following issue recently after upgrading to 1.0.1.

Whenever a property name itself contains the string literal "get" as part of its name, it gets replaced with an empty string in the final output. For example: "budget" becomes "bud" or "targets" becomes "tars".

The culprit seems to be in the following method in JsonViewSerializer:

private String getFieldNameFromGetter(Method method) {
      String name = method.getName().replace("get", "");
      return name.substring(0, 1).toLowerCase() + name.substring(1);
    }

I think replaceFirst instead of replace would solve this issue.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions