Class BusinessDomainObject
- Direct Known Subclasses:
GeneratedQuery
,LLM
,Prompt
,PromptType
,SampleQuery
Provides a versioning mechanism that updates automatically when
bound JavaFX Property
values change.
Subclasses should call registerProperties(Property[])
at the end of their constructors to ensure version tracking.
Versioning: The version
is either set
explicitly or refreshed to the current time when properties change.
- Since:
- 1.0
- Author:
- Felix Seggebäing
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BusinessDomainObject
(Long version) Creates a newBusinessDomainObject
. -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the current version of this object.protected void
Refreshes the version value to the current time.protected void
registerProperties
(javafx.beans.property.Property<?>... properties) Registers change listeners on the given JavaFX properties.protected void
setVersion
(Long version) Sets the version of this object.
-
Constructor Details
-
BusinessDomainObject
Creates a newBusinessDomainObject
.Initializes the version to the given value if non-null, otherwise sets it to the current time.
- Parameters:
version
- initial version value, ornull
to auto-generate
-
-
Method Details
-
registerProperties
protected void registerProperties(javafx.beans.property.Property<?>... properties) Registers change listeners on the given JavaFX properties.Must be called as the last statement in each subclass constructor to ensure that the version is updated only after all initial property values have been set. Once registered, any change to one of the observed properties triggers
refreshVersion()
.- Parameters:
properties
- the properties to observe for changes
-
setVersion
Sets the version of this object.If a non-null value is provided, it is used directly. If
null
, the version is refreshed to the current time.- Parameters:
version
- explicit version value, ornull
to auto-generate
-
getVersion
public long getVersion()Returns the current version of this object.- Returns:
- the version value
-
refreshVersion
protected void refreshVersion()Refreshes the version value to the current time.Sets
version
to the number of seconds since the Unix epoch.
-