Record Class ModelState<T>
java.lang.Object
java.lang.Record
io.fluxzero.sdk.modeling.ModelState<T>
- Type Parameters:
T- state value type- Record Components:
id- exact persisted Model identitytype- requested Java state contractvalue- stored current value, or null for a missing/deleted Modelhead- durable version observed with the document, or null for a missing ModelstateIndex- namespace-wide boundary at which the version was verified
public record ModelState<T>(String id, Class<T> type, T value, io.fluxzero.common.api.modeling.ModelHeadState head, long stateIndex)
extends Record
A document-backed current Model value verified against a durable head at
stateIndex().
This is an explicit read-only state contract, not a replayed Entity or a transactional Graph. It neither loads
history nor registers commit read dependencies. Use injected Models/Graphs for transactional invariants.
Missing Models have a null head; deleted Models have a deleted head. Both have a null value.
Repository reads require a matching Runtime and proof captured with trusted Model document materialization;
older unproven documents and ordinary search overwrites fail verification rather than falling back to replay.-
Constructor Summary
ConstructorsConstructorDescriptionModelState(String id, Class<T> type, T value, io.fluxzero.common.api.modeling.ModelHeadState head, long stateIndex) Creates an instance of aModelStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.get()Returns the current value, or null for a missing/deleted Model.final inthashCode()Returns a hash code value for this object.io.fluxzero.common.api.modeling.ModelHeadStatehead()Returns the value of theheadrecord component.id()Returns the value of theidrecord component.booleanReturns whether a live value was observed.optional()Returns the current value as an optional.longReturns the value of thestateIndexrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
ModelState
public ModelState(String id, Class<T> type, T value, io.fluxzero.common.api.modeling.ModelHeadState head, long stateIndex) Creates an instance of aModelStaterecord class.- Parameters:
id- the value for theidrecord componenttype- the value for thetyperecord componentvalue- the value for thevaluerecord componenthead- the value for theheadrecord componentstateIndex- the value for thestateIndexrecord component
-
-
Method Details
-
get
Returns the current value, or null for a missing/deleted Model. -
isPresent
public boolean isPresent()Returns whether a live value was observed. -
optional
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
-
type
-
value
-
head
-
stateIndex
public long stateIndex()Returns the value of thestateIndexrecord component.- Returns:
- the value of the
stateIndexrecord component
-