Repository navigation
CSSTUDIO-3793 Add interface DescriptionProvider
#146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
8a683e5
6d27ff8
e9c6996
7f50daa
b3ed581
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package org.epics.vtype; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| public interface DescriptionProvider { | ||
| public Optional<String> getDescription(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| */ | ||
| package org.epics.vtype; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * Immutable {@code VBoolean} implementation. | ||
| * | ||
|
|
@@ -14,14 +16,17 @@ final class IVBoolean extends VBoolean { | |
| private final Boolean value; | ||
| private final Alarm alarm; | ||
| private final Time time; | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think maybe there is a sonarlint against having Optionals for input params, but not sure...
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to encode the intent in the type, and representing the absence of a description by |
||
| VType.argumentNotNull("value", value); | ||
| VType.argumentNotNull("alarm", alarm); | ||
| VType.argumentNotNull("time", time); | ||
| VType.argumentNotNull("description", description); | ||
| this.value = value; | ||
| this.alarm = alarm; | ||
| this.time = time; | ||
| this.description = description; | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -39,4 +44,8 @@ public Time getTime() { | |
| return time; | ||
| } | ||
|
|
||
| @Override | ||
| public Optional<String> getDescription() { | ||
| return description; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an overload so the api is backwards compatible.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IVBooleanis not part of the API: neither the constructor nor the classIVBooleanare visible outside of the package (they are not declaredpublic).