Class FunctionalProperty<T>

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

public class FunctionalProperty<T> extends Property<T>
A property whose behaviour is defined using functional interfaces.

This implementation allows dynamic configuration of property behaviour, useful when working with external systems or when subclassing is not feasible (e.g., in Python via JPype).

See Also:
  • Constructor Details

    • FunctionalProperty

      public FunctionalProperty(String name, boolean isRecorded, Class<T> type, PropertyGetterFunction<T> getter, PropertySetterFunction<T> setter, PropertyRunFunction<T> runLogic)
      Constructs a functional property with the given name, type, recording flag, and logic.
      Parameters:
      name - the property name
      isRecorded - whether the property is recorded
      type - the value type of the property
      getter - logic to retrieve the property value
      setter - logic to update the property value
      runLogic - logic to execute during the run() call
  • Method Details

    • get

      public T get()
      Description copied from class: Property
      Retrieves the current value of this property.
      Specified by:
      get in class Property<T>
      Returns:
      the value of the property
    • set

      public void set(T value)
      Description copied from class: Property
      Updates the value of this property.
      Specified by:
      set in class Property<T>
      Parameters:
      value - the new value to assign
    • run

      public void run()
      Description copied from class: Property
      Executes logic for updating or using the property's value.
      Specified by:
      run in class Property<T>
    • deepCopy

      public FunctionalProperty<T> deepCopy()
      Specified by:
      deepCopy in interface DeepCopyable<T>
      Overrides:
      deepCopy in class Property<T>