Support alternate naming for boolean getters in ReflectionDBObject

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.1
    • Component/s: Codecs
    • None
    • Environment:
      java version "1.6.0_21"
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      "is"-style getter is ignored by ReflectionObject.

      Domain class:
      --------------------------------------------------------

      package test;

      import com.mongodb.ReflectionDBObject;

      public class Something extends ReflectionDBObject {
      private String kk;
      private boolean bb;

      public Something(String kk, boolean bb)

      { this.kk = kk; this.bb = bb; }

      public String getKk()

      { return kk; }

      public void setKk(String kk)

      { this.kk = kk; }

      public boolean isBb()

      { return bb; }

      public void setBb(boolean bb)

      { this.bb = bb; }

      }

      Application class:
      --------------------------------------------------------

      package test;

      import com.mongodb.*;

      import java.net.UnknownHostException;

      public class BooleanGetterApp {
      public static void main(String[] args) {
      try

      { Mongo m = new Mongo("localhost", 27017); DB db = m.getDB("mydb"); DBCollection coll = db.getCollection("testCollection"); coll.drop(); Something something = new Something("kk", true); coll.save(something); DBObject dbObject = coll.findOne(); System.out.println(dbObject.toString()); }

      catch (UnknownHostException e)

      { e.printStackTrace(); }

      }
      }

      Application output:
      --------------------------------------------------------

      { "_id" :

      { "$oid" : "4cab3c5417066088cabbebf3"}

      , "Kk" : "kk"}

      – boolean value was ignored.

            Assignee:
            Unassigned
            Reporter:
            Ilya Brodotsky
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: