Skip to content

Commit eac102c

Browse files
Merge pull request #1299 from SpineEventEngine/trigger-build
Encapsulate checking `Repository` context
2 parents 6ebebcc + e5ccfbf commit eac102c

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

server/src/main/java/io/spine/server/entity/Repository.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public final TypeUrl entityStateType() {
203203
public void registerWith(BoundedContext context) {
204204
checkNotNull(context);
205205
boolean sameValue = context.equals(this.context);
206-
if (this.context != null && !sameValue) {
206+
if (hasContext() && !sameValue) {
207207
throw newIllegalStateException(
208208
"The repository `%s` has the Bounded Context (`%s`) assigned." +
209209
" This operation can be performed only once." +
@@ -222,14 +222,11 @@ public void registerWith(BoundedContext context) {
222222
}
223223

224224
/**
225-
* {@inheritDoc}
226-
*
227-
* <p>Unlike, {@link #isOpen()}, once the repository is
228-
* {@linkplain #registerWith(BoundedContext) initialized}, this method always returns {@code true}.
225+
* Tells if the repository is registered in a {@code BoundedContext}.
229226
*/
230227
@Override
231228
public boolean isRegistered() {
232-
return context != null;
229+
return hasContext();
233230
}
234231

235232
/**
@@ -262,7 +259,7 @@ protected final boolean hasContext() {
262259
* if the repository has no context assigned
263260
*/
264261
protected final BoundedContext context() {
265-
checkState(context != null,
262+
checkState(hasContext(),
266263
"The repository (class: `%s`) is not registered with a `BoundedContext`.",
267264
getClass().getName());
268265
return context;
@@ -364,7 +361,7 @@ public void close() {
364361
*/
365362
@Override
366363
public final boolean isOpen() {
367-
return context != null;
364+
return hasContext();
368365
}
369366

370367
@Internal

version.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/**
3535
* Version of this library.
3636
*/
37-
val coreJava = "1.5.28"
37+
val coreJava = "1.5.29"
3838

3939
/**
4040
* Versions of the Spine libraries that `core-java` depends on.

0 commit comments

Comments
 (0)