This is leveraging the setter injection that happens on Entity creation to ensure that the UUID is set

@param UuidFactory $uuidFactory
333998
public function injectUuid(UuidFactory $uuidFactory)
    {
        if (null === $this->id) {
            $this->setId(self::buildUuid($uuidFactory));
        }
    }
498768
public void setUUID(String id) {
		try {
			this.value = (id != null) ? UUID.fromString(id) : null;
		} catch (Throwable exception) {
			assert id != null;
			this.value = UUID.nameUUIDFromBytes(id.getBytes());
		}
		this.type = AttributeType.UUID;
		this.assigned = this.value != null;
	}
1140186
public final void setWrapFactory(WrapFactory wrapFactory)
    {
        if (sealed) onSealedMutation();
        if (wrapFactory == null) throw new IllegalArgumentException();
        this.wrapFactory = wrapFactory;
    }
1244662
@Override
	public void setUUID(UUID id) {
		assert id != null;
		final UUID old = getUUID();
		if (!id.equals(old)) {
			super.setUUID(id);
			firePrimitiveChanged();
		}
	}
100018
public function setFactory($factory)
    {
        if (is_string($factory) && strpos($factory, '::') !== false) {
            $factory = explode('::', $factory, 2);
        }

        $this->factory = $factory;

        return $this;
    }
800511
public function set(string $id, string $class = null): void
    {
        $this->autoResolvable[$id] = $class ?? $id;
    }
75448
synchronized void setChannelFactory(ChannelFactory factory) throws ChannelFactoryException {
        if (factory != null && cf != null) {
            throw new ChannelFactoryException("ChannelFactory already exists");
        }
        this.cf = factory;
    }
231281
public function handleUuid(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();

        if (!$document instanceof UuidBehavior) {
            return;
        }

        $node = $event->getNode();

        $accessor = $event->getAccessor();
        $accessor->set(
            'uuid',
            $node->getIdentifier()
        );
    }
216501
public final void setEntryFactory(Callback<CreateEntryParameter, Entry<?>> factory) {
        Objects.requireNonNull(factory);
        entryFactoryProperty().set(factory);
    }
1065155
public static function bootUuidBinaryModelTrait()
    {
        static::creating(function ($model) {
            // Only generate UUID if it wasn't set by already.
            $key = $model->getKeyName();
            if (!isset($model->attributes[$key])) {
                // This is necessary because on \Illuminate\Database\Eloquent\Model::performInsert
                // will not check for $this->getIncrementing() but directly for $this->incrementing
                $model->incrementing = false;
                $uuidVersion = (!empty($model->uuidVersion) ? $model->uuidVersion : 4);   // defaults to 4
                $uuid = Uuid::generate($uuidVersion);
                $model->attributes[$key] = (property_exists($model, 'uuidOptimization') && $model::$uuidOptimization ? $model::toOptimized($uuid->string) : $uuid->bytes);
            }
        }, 0);
    }
371069
public function setQueryFactory(AbstractRepositoryQueryFactory $queryFactory)
    {
        $queryFactory->setRepository($this);
        
        $this->queryFactory = $queryFactory;
        
        return $this;
    }
1325770
public static function setPuliFactory($puliFactory)
    {
        if (!is_callable([$puliFactory, 'createRepository']) || !is_callable([$puliFactory, 'createDiscovery'])) {
            throw new \InvalidArgumentException('The Puli Factory must expose a repository and a discovery');
        }
        self::$puliFactory = $puliFactory;
        self::$puliDiscovery = null;
    }
905555
public function registerFactory(string $produced_class, Factory $factory)
    {
        $this->factories[$produced_class] = $factory;
        return $this;
    }
199825
public function setFactory($factory)
    {
        $this->changes['factory'] = true;

        if (\is_string($factory) && false !== strpos($factory, '::')) {
            $factory = explode('::', $factory, 2);
        } elseif ($factory instanceof Reference) {
            $factory = [$factory, '__invoke'];
        }

        $this->factory = $factory;

        return $this;
    }
404798
public static void setConverterFactoryClass(Configuration conf,
      Class<? extends ConverterFactory> converterFactoryClass) {
    conf.setClass(CONVERTER_FACTORY, converterFactoryClass, ConverterFactory.class);
    LOG.debug("Set input ConverterFactory class on conf: {}", converterFactoryClass);
  }
1281273
public void setUUID(SIBUuid12 value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, "setUUID", value);
        }
        _uuid = value;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "setUUID");
    }
757998
public function setIdentifier($identifier)
    {
        if ($this->identifier && $this->identifier !== $identifier) {
            throw new MappingException('Cannot map the identifier to more than one property');
        }

        $this->identifier = $identifier;
    }