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 identity
type - requested Java state contract
value - stored current value, or null for a missing/deleted Model
head - durable version observed with the document, or null for a missing Model
stateIndex - 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

    Constructors
    Constructor
    Description
    ModelState(String id, Class<T> type, T value, io.fluxzero.common.api.modeling.ModelHeadState head, long stateIndex)
    Creates an instance of a ModelState record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    get()
    Returns the current value, or null for a missing/deleted Model.
    final int
    Returns a hash code value for this object.
    io.fluxzero.common.api.modeling.ModelHeadState
    Returns the value of the head record component.
    id()
    Returns the value of the id record component.
    boolean
    Returns whether a live value was observed.
    Returns the current value as an optional.
    long
    Returns the value of the stateIndex record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the type record component.
    Returns the value of the value record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a ModelState record class.
      Parameters:
      id - the value for the id record component
      type - the value for the type record component
      value - the value for the value record component
      head - the value for the head record component
      stateIndex - the value for the stateIndex record component
  • Method Details

    • get

      public T get()
      Returns the current value, or null for a missing/deleted Model.
    • isPresent

      public boolean isPresent()
      Returns whether a live value was observed.
    • optional

      public Optional<T> optional()
      Returns the current value as an optional.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • type

      public Class<T> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • value

      public T value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • head

      public io.fluxzero.common.api.modeling.ModelHeadState head()
      Returns the value of the head record component.
      Returns:
      the value of the head record component
    • stateIndex

      public long stateIndex()
      Returns the value of the stateIndex record component.
      Returns:
      the value of the stateIndex record component