Last active
October 21, 2017 20:58
-
-
Save rachitmishra/fb44d1c0c6ebbd5c118102c9d7dcbcc2 to your computer and use it in GitHub Desktop.
dagger-module-provides
This file contains hidden or 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
package di | |
import dagger.Module | |
import dagger.Provides | |
import di.dependencies.* | |
@Module | |
abstract class ComputerModule(private val memorySize: Int, | |
private val vMemorySize: Int) { | |
@Provides | |
fun providesRam(): Ram = Ddr5Ram(memorySize) | |
@Provides | |
fun providesGraphicRam(): VideoRam = Ddr5VideoRam(vMemorySize) | |
@Provides | |
@Named("large") | |
fun providesLargeGraphicRam(): VideoRam = Ddr5VideoRam(vMemorySize) | |
@Provides | |
fun providesMotherBoardWithLargeVideoRam(processor: Cpu, | |
ram: Ram, | |
@Named("large") videoRam: VideoRam): Gigabyte | |
= Gigabyte(processor, ram, videoRam) | |
@Module | |
companion object { | |
@Provides | |
@JvmStatic | |
fun providesPowerSupply(): Psu = Psu() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment