code: public EntityInstanceWrapper buildInstanceWrapper(final Object instance) throws PMException {
          final EntityInstanceWrapper wrapper = new EntityInstanceWrapper(instance);
          if (hasEntity() && !getEntityContainer().isSelectedNew()) {
              wrapper.setInstanceId(getDataAccess().getInstanceId(this, wrapper));
          }
          return wrapper;
      }
docs: Creates a new instance wrapper with the instance and the instanceId.