Skip to content

Commit

Permalink
Merge pull request #2967 from matsim-org/simplify-abstract-module
Browse files Browse the repository at this point in the history
Refactor AbtractModule
  • Loading branch information
paulheinr authored Nov 28, 2023
2 parents ba41461 + 45111eb commit 32c0d83
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ public final void configure(Binder binder) {
// not in this class.
this.binder = binder.skipSources(AbstractModule.class);

initializeMultibinders();

this.install();
}

private void initializeMultibinders() {
// We do need to make these calls here in order to register the multi binders. Otherwise, guice doesn't know, that they exist. In particular,
// if none of the corresponding addXXXBinding methods was called, the set binder would not be registered, and guice would complain.
this.mobsimListenerMultibinder = Multibinder.newSetBinder(this.binder, MobsimListener.class);
this.snapshotWriterMultibinder = Multibinder.newSetBinder(this.binder, SnapshotWriter.class);
this.eventHandlerMultibinder = Multibinder.newSetBinder(this.binder, EventHandler.class);
Expand All @@ -124,7 +132,6 @@ public final void configure(Binder binder) {
new TypeLiteral<AttributeConverter<?>>() {} );
this.qsimModulesMultibinder = Multibinder.newSetBinder(this.binder, AbstractQSimModule.class);
this.qsimOverridingModulesMultibinder = Multibinder.newSetBinder( this.binder, AbstractQSimModule.class, Names.named( "overridesFromAbstractModule" ) );
this.install();
}

public abstract void install();
Expand Down

0 comments on commit 32c0d83

Please sign in to comment.