Class LazyId
java.lang.Object
io.fluxzero.sdk.common.LazyId
A lazily initialized identifier that serializes as a plain string.
Unlike using Lombok's lazy getters, LazyId ensures the ID is generated only once and remains stable even
after calling .toBuilder() on the enclosing object. This makes it useful in scenarios where the ID should be
deterministically generated only once per logical instance, including deserialization and cloning scenarios.
If the ID is not provided directly, a supplier (e.g., Fluxzero::generateId) can be used to compute it
lazily on first access. The ID is then cached and reused.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LazyId
public LazyId()Constructs a newLazyIdwith a default ID supplier usingFluxzero::generateId. -
LazyId
-
LazyId
Constructs aLazyIdwith a known ID value. No computation will occur.- Parameters:
id- the ID value (converted to string if non-null)
-
-
Method Details
-
toString
-