domino-aggregator-apt

provides a declarative way to wait for a set of events to be completed before executing some code.

License

License

GroupId

GroupId

org.dominokit
ArtifactId

ArtifactId

domino-aggregator-apt
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

domino-aggregator-apt
provides a declarative way to wait for a set of events to be completed before executing some code.
Project URL

Project URL

https://github.com/DominoKit/domino-aggregator
Project Organization

Project Organization

Dominokit

Download domino-aggregator-apt

How to add to project

<!-- https://jarcasting.com/artifacts/org.dominokit/domino-aggregator-apt/ -->
<dependency>
    <groupId>org.dominokit</groupId>
    <artifactId>domino-aggregator-apt</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.dominokit/domino-aggregator-apt/
implementation 'org.dominokit:domino-aggregator-apt:1.0.2'
// https://jarcasting.com/artifacts/org.dominokit/domino-aggregator-apt/
implementation ("org.dominokit:domino-aggregator-apt:1.0.2")
'org.dominokit:domino-aggregator-apt:jar:1.0.2'
<dependency org="org.dominokit" name="domino-aggregator-apt" rev="1.0.2">
  <artifact name="domino-aggregator-apt" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.dominokit', module='domino-aggregator-apt', version='1.0.2')
)
libraryDependencies += "org.dominokit" % "domino-aggregator-apt" % "1.0.2"
[org.dominokit/domino-aggregator-apt "1.0.2"]

Dependencies

test (2)

Group / Artifact Type Version
junit : junit jar 4.13.1
org.assertj : assertj-core jar 3.7.0

Project Modules

There are no modules declared in this project.

Development Build Status Maven Central Sonatype Nexus (Snapshots) GWT3/J2CL compatible

domino-aggregate

provides a declarative way to wait for a set of events to be completed before executing some code.

This might be implemented later using Rx or Futures.

Maven dependencies

  • Release

    • Api

      <dependency>
        <groupId>org.dominokit</groupId>
        <artifactId>domino-aggregator-shared</artifactId>
        <version>1.0.0</version>
      </dependency>
      
    • Annotation processor

      <dependency>
        <groupId>org.dominokit</groupId>
        <artifactId>domino-aggregator-apt</artifactId>
        <version>1.0.0</version>
        <scope>provided</scope>
      </dependency>
  • Development snapshot

    • Api

      <dependency>
        <groupId>org.dominokit</groupId>
        <artifactId>domino-aggregator-shared</artifactId>
        <version>HEAD-SNAPSHOT</version>
      </dependency>
      
    • Annotation processor

      <dependency>
        <groupId>org.dominokit</groupId>
        <artifactId>domino-aggregator-apt</artifactId>
        <version>HEAD-SNAPSHOT</version>
        <scope>provided</scope>
      </dependency>

Usage

  • Basic
ContextAggregator.ContextWait<String> waitForString = ContextAggregator.ContextWait.create();
ContextAggregator.ContextWait<Integer> waitForInteger = ContextAggregator.ContextWait.create();

ContextAggregator.waitFor(waitForString, waitForInteger)
        .onReady(() -> {
            //will be called when both waits are resolved.
        });

waitForString.complete("some string");
waitForInteger.complete(5);
  • Declarative

1 - iIn a class define a method and annotate it as @Aggregate specifying a desired class name, and the method parameters represent the events to be received.

public class App{
    @Aggregate(name = "EventsAggregate")
    public void onAllEventCompleted(String event1, Long event2){
        //will be called when both waits are resolved.
    }
}

2 - Define a field of the aggregate class, which should be generated for you

private EventsAggregate eventsAggregate = new EventsAggregate();

3 - Init the aggregate with an instance of the target class from which the method will be called.

eventsAggregate.init(appInstance);

4- Complete the events to invoke the target method

eventsAggregate.completeEvent1("some string");
eventsAggregate.completeEvent2(5);

Full sample

public class AggregateTest {

    private EventsAggregate eventsAggregate = new EventsAggregate();

    
    public void AggregateTest(){
        eventsAggregate.init(this);
    }

    @Aggregate(name = "EventsAggregate")
    public void onAllEventCompleted(String event1, Long event2){
        //this will be called when both events are completed.
    }

    //In some other parts you complete the events, something like in a success of failed rest call.
    public void shouldCallAggregateMethod(){
        eventsAggregate.completeEvent1("some String");
        eventsAggregate.completeEvent2(5L);
    }
}
org.dominokit

DominoKit

Service Providers, UI library, Modular framework and GWT experts.

Versions

Version
1.0.2
1.0.1
1.0.0