Skip to content

Compatibility with non-JavaBeans-style property accessors #1601

@danielsonjh

Description

@danielsonjh

The following docs from AutoValue and Immutables seem to indicate that both libraries do not recommend using the JavaBeans-style property accessors (getProperty(), isBoolean(), etc)
https://github.com/google/auto/blob/master/value/userguide/index.md
https://immutables.github.io/

Both libraries do support JavaBeans-style accessors to some degree however
https://github.com/google/auto/blob/master/value/userguide/howto.md#beans
https://immutables.github.io/style.html

In Mapstruct 1.3.0.Beta1 only JavaBeans-style properties are supported.
To support this new convention, Mapstruct will need an option to treat all methods as potential properties.
With no differentiation between standard methods and property getters, it seems that Mapstruct either needs:

  1. Mapped classes to only have property getters as methods.
  2. An annotation to allow Mapstruct to ignore certain methods when not using JavaBeans-style conventions.

Option 1 is up to the developer, and for Option 2, there is already an annotation that can do this, @Mapping(target = "somemethod", ignore = true)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions