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

Introduce convention to disable getters/setters during POJO serialization

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • POJO
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

    Description

      Currently, there isn't a nice way for users of the POJO persistence mechanism to prevent property models from automatically incorporating getXXX methods as properties.  I'm suggesting the introduction of a FieldsOnlyConvention (or something similar) that will allow users of the Java driver to enforce methods are never used globally (rather than depend on developers correctly annotating every single method with @BsonIgnore)

       

      For my company, this has been a source of bugs, data leakage, and data duplication.  Potentially a security concern.  But mostly data duplication.  It's easy for a developer to add a "getXYZ" method that provides a new view of the underlying data (without realizing that the POJO will end up with lots of duplicated data when stored as a MongoDB document. 

      There is no great way for developers in user land to develop a solution for this (I've tried). 

      Attachments

        Activity

          People

            ross@mongodb.com Ross Lawley
            robert@unitydynamics.com Robert Fox
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: