-
Notifications
You must be signed in to change notification settings - Fork 12
[1.x] Expose the EnvSetting
class
#1550
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
Conversation
…current environment type.
… for the current environment type.
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.
@Artem-Semenov-dev Mostly LGTM. Please see my comments.
readWriteExecutors.shutdownNow(); | ||
readWriteExecutors.awaitTermination(500, MILLISECONDS); | ||
} catch (InterruptedException e) { | ||
throw illegalStateWithCauseOf(e); |
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.
I am not sure we want that, I would just ignore.
If you still think we need to re-throw, please have a method-level comment explaining the behaviour.
* the type of the environment | ||
*/ | ||
void use(V value, Class<? extends EnvironmentType> type) { | ||
public void use(V value, Class<? extends EnvironmentType> type) { |
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 we could return this
? For call chaining, that is.
I am asking since the example from the PR description is a bit mouthful. I think I would look better like this:
EnvSetting<UserReader> setting = new EnvSetting<>();
setting.use(projectsUserReader(), Production.class)
.use(localUserReader(), Local.class)
.use(testsUserReader(), Tests.class);
UserReader currentUserReader = setting.use(projectsUserReader(), Production.class)
.use(localUserReader(), Local.class)
.use(testsUserReader(), Tests.class)
.value(); This should be an illustration of some real-world usage. In which (on Earth) scenario, one would call |
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.
@Artem-Semenov-dev LGTM. However, please change the PR description according to my comment.
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.
@Artem-Semenov-dev please update the README.md
. There is a version number that you've changed.
The
EnvSetting
class is a tool that allows configuring the value that may differ across environment types. Previously it was an internal tool, but now it is available for all Spine projects.Usage example:
This changeset includes the following changes in the
EnvSetting
: