Convert Guice modules to objects

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent d119cc07b5
commit 0c76c610bd
  1. 2
      bundler/src/main/java/dev/openrs2/bundler/BundleCommand.kt
  2. 4
      bundler/src/main/java/dev/openrs2/bundler/BundlerModule.kt
  3. 4
      conf/src/main/java/dev/openrs2/conf/ConfigModule.kt
  4. 2
      crypto/src/main/java/dev/openrs2/crypto/CryptoModule.kt
  5. 2
      deob-processor/src/main/java/dev/openrs2/deob/processor/NameMapProcessor.kt
  6. 2
      game/src/main/java/dev/openrs2/game/GameCommand.kt
  7. 2
      game/src/main/java/dev/openrs2/game/GameModule.kt
  8. 2
      yaml/src/main/java/dev/openrs2/yaml/YamlModule.kt

@ -8,7 +8,7 @@ fun main(args: Array<String>) = BundleCommand().main(args)
class BundleCommand : CliktCommand(name = "bundle") {
override fun run() {
val injector = Guice.createInjector(BundlerModule())
val injector = Guice.createInjector(BundlerModule)
val bundler = injector.getInstance(Bundler::class.java)
bundler.run(Paths.get("nonfree/lib"), Paths.get("nonfree/var/cache/bundle"), Paths.get("etc/loader.p12"))
}

@ -3,8 +3,8 @@ package dev.openrs2.bundler
import com.google.inject.AbstractModule
import dev.openrs2.crypto.CryptoModule
class BundlerModule : AbstractModule() {
object BundlerModule : AbstractModule() {
override fun configure() {
install(CryptoModule())
install(CryptoModule)
}
}

@ -4,9 +4,9 @@ import com.google.inject.AbstractModule
import com.google.inject.Scopes
import dev.openrs2.yaml.YamlModule
class ConfigModule : AbstractModule() {
object ConfigModule : AbstractModule() {
override fun configure() {
install(YamlModule())
install(YamlModule)
bind(Config::class.java)
.toProvider(ConfigProvider::class.java)

@ -4,7 +4,7 @@ import com.google.inject.AbstractModule
import com.google.inject.Scopes
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
class CryptoModule : AbstractModule() {
object CryptoModule : AbstractModule() {
override fun configure() {
bind(RSAPrivateCrtKeyParameters::class.java)
.toProvider(RsaKeyProvider::class.java)

@ -46,7 +46,7 @@ class NameMapProcessor : AbstractProcessor() {
private lateinit var localScanner: LocalVariableScanner
init {
val injector = Guice.createInjector(YamlModule())
val injector = Guice.createInjector(YamlModule)
mapper = injector.getInstance(ObjectMapper::class.java)
}

@ -7,7 +7,7 @@ fun main(args: Array<String>) = GameCommand().main(args)
class GameCommand : CliktCommand(name = "game") {
override fun run() {
val injector = Guice.createInjector(GameModule())
val injector = Guice.createInjector(GameModule)
val server = injector.getInstance(GameServer::class.java)
server.run()
}

@ -2,7 +2,7 @@ package dev.openrs2.game
import com.google.inject.AbstractModule
class GameModule : AbstractModule() {
object GameModule : AbstractModule() {
override fun configure() {
// empty
}

@ -6,7 +6,7 @@ import com.google.inject.AbstractModule
import com.google.inject.Scopes
import com.google.inject.multibindings.Multibinder
class YamlModule : AbstractModule() {
object YamlModule : AbstractModule() {
override fun configure() {
Multibinder.newSetBinder(binder(), Module::class.java)

Loading…
Cancel
Save