code: public JsiiObjectRef nativeToObjRef(final Object nativeObject) {
          if (nativeObject instanceof JsiiObject) {
              return ((JsiiObject) nativeObject).getObjRef();
          }
  
          for (String objid : this.objects.keySet()) {
              Object obj = this.objects.get(objid);
              if (obj == nativeObject) {
                  return JsiiObjectRef.fromObjId(objid);
              }
          }
  
          // we don't know of an jsii object that represents this object, so we will need to create it.
          return createNewObject(nativeObject);
      }
docs: Returns the jsii object reference given a native object.
  
  If the native object extends JsiiObject (directly or indirectly), we can grab the objref
  from within the JsiiObject.
  
  Otherwise, we have a "pure" native object on our hands, so we will first perform a reverse lookup in
  the objects cache to see if it was already created, and if it wasn't, we create a new empty JS object.
  Note that any native overrides will be applied by createNewObject().
  
  @param nativeObject The native object to obtain the reference for
  @return A jsii object reference