Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Jun 30, 2024
1 parent 21677d9 commit a1099e2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
public interface HasContext<T> {

default void update(T context) {
update(context, Operation.UPDATED);
}

default void update(T context, Operation operation) {
getContextListeners()
.forEach(
contextListener -> {
contextListener.onContextUpdated(context);
contextListener.onContextChange(context, operation);
});
}

Expand All @@ -40,6 +44,25 @@ default T removeChangeListener(ContextListener<? super T> contextListener) {
}

interface ContextListener<T> {
void onContextUpdated(T context);
void onContextChange(T context, Operation operation);
}

interface Operation {
Operation CREATED = () -> "CREATED";
Operation UPDATED = () -> "UPDATED";
Operation DELETED = () -> "DELETED";

String getKey();

default boolean isEqualTo(Operation other) {
return getKey().equals(other.getKey());
}

default Operation when(Operation other, Runnable runnable) {
if (isEqualTo(other)) {
runnable.run();
}
return this;
}
}
}
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<url>https://github.com/DominoKit/domino-brix</url>
</scm>


<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
Expand Down Expand Up @@ -406,4 +407,11 @@
</build>
</profile>
</profiles>

<repositories>
<repository>
<id>SNAPSHOTS</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
</project>

0 comments on commit a1099e2

Please sign in to comment.