Class Property<T>

java.lang.Object
modelarium.attributes.Attribute
modelarium.attributes.Property<T>
Type Parameters:
T - the type of value this property holds
All Implemented Interfaces:
Serializable, DeepCopyable<Attribute>
Direct Known Subclasses:
FunctionalProperty

public abstract class Property<T> extends Attribute
Represents a stateful, typed property attribute.

Properties hold and expose a value of type T, and are updated during each tick via the run() method. Property values may represent counters, flags, metrics, etc.

See Also:
  • Constructor Details

    • Property

      public Property(String name, boolean isRecorded, Class<T> type)
      Constructs a property with a specific name, recording flag, and type.
      Parameters:
      name - the property name
      isRecorded - whether it is recorded
      type - the class of the property's value type
    • Property

      public Property(boolean isRecorded, Class<T> type)
      Constructs a property with a generated name, a recording flag, and type.
      Parameters:
      isRecorded - whether the property is recorded
      type - the class of the property's value type
    • Property

      public Property(String name, Class<T> type)
      Constructs a property with a specific name, recording enabled, and type.
      Parameters:
      name - the property name
      type - the class of the property's value type
    • Property

      public Property(Class<T> type)
      Constructs a property with a generated name, recording enabled, and type.
      Parameters:
      type - the class of the property's value type
  • Method Details

    • getType

      public Class<T> getType()
      Gets the runtime type of this property's value.
      Returns:
      the value type class
    • set

      public abstract void set(T value)
      Updates the value of this property.
      Parameters:
      value - the new value to assign
    • get

      public abstract T get()
      Retrieves the current value of this property.
      Returns:
      the value of the property
    • run

      public abstract void run()
      Executes logic for updating or using the property's value.
      Specified by:
      run in class Attribute
    • deepCopy

      public Property<T> deepCopy()