code: public Object encode(final Object o) {
          if (o == null) {
              return null;
          }
          return encode(o.getClass(), o);
      }
docs: encode the type safe java object into the corresponding {@link com.mongodb.DBObject}
  
  @param o The object to encode
  @return the encoded version of the object