Created
September 19, 2019 09:25
-
-
Save androuino/d11de27fb1a61fbcd64b66ea4b619e59 to your computer and use it in GitHub Desktop.
This is my AppComponent Interface
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
import dagger.BindsInstance | |
import dagger.Subcomponent | |
import javafx.application.Application | |
import javafx.fxml.FXMLLoader | |
import javafx.stage.Stage | |
import java.net.URL | |
import java.util.* | |
import java.util.function.Function | |
@FxAppScoped | |
@Subcomponent(modules = [FxAppModule::class]) | |
interface FxAppComponent { | |
fun fxmlLoaderFactory(): Function<URL, FXMLLoader> | |
fun loader(fxmlUrl: URL): FXMLLoader { | |
return fxmlLoaderFactory().apply(Objects.requireNonNull(fxmlUrl)) | |
} | |
@Subcomponent.Builder | |
interface Builder { | |
@BindsInstance | |
fun application(application: Application): Builder | |
@BindsInstance | |
fun mainWindow(mainWindow: Stage?): Builder | |
fun build(): FxAppComponent | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment