This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Wokdsem/1.3.0
1.3.0
- Loading branch information
Showing
14 changed files
with
107 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
kommander/src/main/java/com/wokdsem/kommander/Deliverers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.wokdsem.kommander; | ||
|
||
class Deliverers { | ||
|
||
static Deliverer DEFAULT_DELIVERER; | ||
|
||
static { | ||
DEFAULT_DELIVERER = new Deliverer() { | ||
@Override | ||
public void deliver(Runnable runnable) { | ||
runnable.run(); | ||
} | ||
}; | ||
} | ||
|
||
private Deliverers() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 23 additions & 12 deletions
35
kommander/src/main/java/com/wokdsem/kommander/RunnableActionBundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,52 @@ | ||
package com.wokdsem.kommander; | ||
|
||
class RunnableActionBundle<T> { | ||
import static com.wokdsem.kommander.Deliverers.DEFAULT_DELIVERER; | ||
|
||
class RunnableActionBundle<T> { | ||
|
||
final Action<T> action; | ||
final Response.OnCompleted<T> onCompleted; | ||
final Response.OnError onError; | ||
|
||
private RunnableActionBundle(Builder<T> builder) { | ||
final Deliverer deliverer; | ||
|
||
private RunnableActionBundle(Builder<T> builder, Deliverer deliverer) { | ||
this.action = builder.action; | ||
this.onCompleted = builder.onCompleted; | ||
this.onError = builder.onError; | ||
this.deliverer = deliverer; | ||
} | ||
|
||
static class Builder<T> { | ||
|
||
private final Action<T> action; | ||
private Response.OnCompleted<T> onCompleted; | ||
private Response.OnError onError; | ||
|
||
private Deliverer deliverer; | ||
|
||
Builder(Action<T> action) { | ||
this.action = action; | ||
} | ||
|
||
|
||
Builder<T> deliverer(Deliverer deliverer) { | ||
this.deliverer = deliverer; | ||
return this; | ||
} | ||
|
||
Builder<T> onCompleted(Response.OnCompleted<T> onCompleted) { | ||
this.onCompleted = onCompleted; | ||
return this; | ||
} | ||
|
||
Builder<T> onError(Response.OnError onError) { | ||
this.onError = onError; | ||
return this; | ||
} | ||
|
||
RunnableActionBundle<T> build() { | ||
return new RunnableActionBundle<>(this); | ||
Deliverer actionDeliverer = deliverer == null ? DEFAULT_DELIVERER : deliverer; | ||
return new RunnableActionBundle<>(this, actionDeliverer); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.