docs: function (object, itf, itfWrapper) {
                  var classpath;
                  var itfConstructor;
                  if (typeUtils.isFunction(itf)) {
                      // interface given by its constructor
                      itfConstructor = itf;
                      classpath = itf.interfaceDefinition.$classpath;
                  } else if (typeUtils.isString(itf)) {
                      // interface given by its classpath (constructor retrieved later if needed)
                      classpath = itf;
                  }
                  var interfaces = object.__$interfaces;
                  var res;
                  // first check if the interface is supported by the interface wrapper, if any:
                  if (itfWrapper != null && !itfWrapper.$interfaces[classpath]) {
                      this.$logError(this.INTERFACE_NOT_SUPPORTED, [classpath, itfWrapper.$classpath]);
                      return null;
                  }
                  // first check if an instance of the interface already exists
                  if (interfaces) {
                      res = interfaces[classpath];
                      if (res) {
                          return res;
                      }
                  }
                  // check if the interface is supported:
                  if (!object.$interfaces[classpath]) {
                      this.$logError(this.INTERFACE_NOT_SUPPORTED, [classpath, object.$classpath]);
                      return null;
                  }
                  if (!itfConstructor) {
                      itfConstructor = Aria.getClassRef(classpath);
                      if (!itfConstructor) {
                          // error is already logged in Aria.getClassRef
                          return null;
                      }
                  }
                  if (!interfaces) {
                      interfaces = {};
                      object.__$interfaces = interfaces;
                  }
                  res = new itfConstructor(object);
                  interfaces[classpath] = res;
                  return res;
              }