Skip to content

Commit a9dc4d6

Browse files
authored
feat: use default interface methods in interceptors (#98)
1 parent c5b453e commit a9dc4d6

6 files changed

Lines changed: 23 additions & 12 deletions

File tree

cosmo-api/src/main/java/org/unitedinternet/cosmo/service/interceptors/CollectionCreateHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
*/
1717
public interface CollectionCreateHandler {
1818

19-
void beforeCreateCollection(CollectionItem collection);
19+
default void beforeCreateCollection(CollectionItem collection) {
20+
}
2021

21-
void afterCreateCollection(CollectionItem collection);
22+
default void afterCreateCollection(CollectionItem collection) {
23+
}
2224
}

cosmo-api/src/main/java/org/unitedinternet/cosmo/service/interceptors/CollectionDeleteHandler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ public interface CollectionDeleteHandler {
1818
/**
1919
* This method contains the code inserted before a collection is deleted.
2020
*/
21-
public void beforeDeleteCollection(String calendarName);
21+
default void beforeDeleteCollection(String calendarName) {
22+
}
23+
2224
/**
2325
* This method contains the code inserted after a collection is deleted.
2426
*/
25-
public void afterDeleteCollection(String calendarName);
27+
default void afterDeleteCollection(String calendarName) {
28+
}
2629
}

cosmo-api/src/main/java/org/unitedinternet/cosmo/service/interceptors/CollectionUpdateHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public interface CollectionUpdateHandler {
2222
* This method contains the code inserted before a collection is updated..
2323
* @param collection
2424
*/
25-
public void beforeUpdateCollection(CollectionItem collection);
25+
void beforeUpdateCollection(CollectionItem collection);
2626

2727
}

cosmo-api/src/main/java/org/unitedinternet/cosmo/service/interceptors/EventAddHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ public interface EventAddHandler {
2525
* @param parent CollectionItem
2626
* @param contentItems Set<ContentItem>
2727
*/
28-
public void beforeAdd(CollectionItem parent, Set<ContentItem> contentItems);
28+
default void beforeAdd(CollectionItem parent, Set<ContentItem> contentItems) {
29+
}
2930

3031
/**
3132
* This method contains the code inserted after an event to be added.
3233
*
3334
* @param parent CollectionItem
3435
* @param contentItems Set<ContentItem>
3536
*/
36-
public void afterAdd(CollectionItem parent, Set<ContentItem> contentItems);
37+
default void afterAdd(CollectionItem parent, Set<ContentItem> contentItems) {
38+
}
3739

3840
}

cosmo-api/src/main/java/org/unitedinternet/cosmo/service/interceptors/EventRemoveHandler.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ public interface EventRemoveHandler {
2525
* @param parent CollectionItem
2626
* @param items Set<Item> to remove
2727
*/
28-
public void beforeRemove(CollectionItem parent, Set<Item> items);
28+
default void beforeRemove(CollectionItem parent, Set<Item> items) {
29+
}
2930

3031
/**
3132
* Intercepter executed after removing an item from a collection.
3233
3334
* @param parent CollectionItem
3435
* @param items Set<Item> to remove
3536
*/
36-
public void afterRemove(CollectionItem parent, Set<Item> items);
37-
}
37+
default void afterRemove(CollectionItem parent, Set<Item> items) {
38+
}
39+
}

cosmo-api/src/main/java/org/unitedinternet/cosmo/service/interceptors/EventUpdateHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public interface EventUpdateHandler {
3737
* @param children
3838
* children to update
3939
*/
40-
public void beforeUpdate(CollectionItem parent, Set<ContentItem> contentItems);
40+
default void beforeUpdate(CollectionItem parent, Set<ContentItem> contentItems) {
41+
}
4142

4243
/**
4344
* This method contains the code inserted after an event to be updated.
@@ -57,5 +58,6 @@ public interface EventUpdateHandler {
5758
* @param children
5859
* children to update
5960
*/
60-
public void afterUpdate(CollectionItem parent, Set<ContentItem> contentItems);
61+
default void afterUpdate(CollectionItem parent, Set<ContentItem> contentItems) {
62+
}
6163
}

0 commit comments

Comments
 (0)