Repository navigation
CSSTUDIO-3793 Add interface DescriptionProvider - #146
abrahamwolk wants to merge 5 commits into
Conversation
…vider with a default implementation.
|
I now see that there is one unresolved question in this implementation: |
The possibility of an |
| private final Optional<String> description; | ||
|
|
||
| IVBoolean(Boolean value, Alarm alarm, Time time) { | ||
| IVBoolean(Boolean value, Alarm alarm, Time time, Optional<String> description) { |
There was a problem hiding this comment.
Maybe add an overload so the api is backwards compatible.
There was a problem hiding this comment.
IVBoolean is not part of the API: neither the constructor nor the class IVBoolean are visible outside of the package (they are not declared public).
| private final Optional<String> description; | ||
|
|
||
| IVBoolean(Boolean value, Alarm alarm, Time time) { | ||
| IVBoolean(Boolean value, Alarm alarm, Time time, Optional<String> description) { |
There was a problem hiding this comment.
I think maybe there is a sonarlint against having Optionals for input params, but not sure...
There was a problem hiding this comment.
I think it's better to encode the intent in the type, and representing the absence of a description by Optional.empty().
This pull request implements the proposal described in #140 (comment).
This pull request is part of work on adding the functionality to represent a description in more types of the library in order to support display descriptions for these types in the PV Table application in Phoebus.
I will create a separate pull request to Phoebus with the added functionality to the PV Table application.Update 2026-10-19: the following is the accompanying pull request to Phoebus with the added functionality to the PV Table application: ControlSystemStudio/phoebus#3967Changes. The following changes are implemented in this pull request:
DescriptionProvideris added:DisplayProvideris changed so that it (1)extends DescriptionProviderand (2) provides adefaultimplementation ofgetDescription(): 6d27ff8VString,VEnum, andVBooleanare declared to implement the new interfaceDescriptionProvider, and implementations ofgetDescription()are added to their implementationsIVString,IVEnum, andIVBoolean. The implementation is backwards compatible in the following way: new methods.of()are implemented forVString,VEnum, andVBooleanthat also (in addition to the arguments of the existing.of()-methods) take a description as an argument (orOptional.empty(), if no description exists). For backwards compatibility, the old.of()-methods are left in place, calling the new.of()-methods withOptional.empty()for the description. The old.of()-methods have been marked@Deprecated.Deprecation of previous functionality. The intention is to add the new functionality in a backwards compatible way, deprecating the old functionality. The idea is that after some time (perhaps years), when projects dependent on the
epics-vtypeshave been updated to use the new.of()-methods, the deprecated.of()-methods can be removed.One design decision to be aware of. The field
descriptionhas not been added to the implementations ofequals()andhashCode()ofVString,VEnum, andVboolean, in order to maximize backwards compatibility. I believe that the "correct" point in time to add thedescriptionfield to the logic of these functions is when the deprecated.of()-methods are removed.Versioning. One final point is the versioning of the
epics-vtypelibrary. At the moment, the pull request forsees merging these changes into1.0.9-SNAPSHOT. Doesepics-vtypeuse semantic versioning? If so, should the version be increased to1.1.0-SNAPSHOTin order to reflect the (backwards compatible) API change?