Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3303

@BsonProperty on a getter is ignored if the field is not serialized anyway

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • 3.10.2
    • POJO
    • None

    Description

      If I have a getter/setter pair like
      public long get07()
      and
      public void set07(long _07)
      I don't see any way to make these serialize and deserialize using the POJO support.
      Adding @BsonProperty("07") has no effect at all and the field is simply ignored completely.
      The only way I found was to add another pair of getter/setter that has some name that is recognized as property and then use the annotation to configure the name.

      Imho adding the annotation to a paramterless getter should be enough to make it serialize.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vampire Björn Kautler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: