All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.snowdream.toybricks.ToyBricks.kt Maven / Gradle / Ivy

package com.github.snowdream.toybricks

import com.github.snowdream.toybricks.annotation.InterfaceLoader
import com.github.snowdream.toybricks.annotation.impl.DefaultInterfaceLoader

/**
 * Created by snowdream on 17/2/10.
 */
class ToyBricks {

        companion object{
            //Default InterfaceLoader
            @JvmField var sDefaultInterfaceLoader: InterfaceLoader = DefaultInterfaceLoader()

            //NewI InterfaceLoader
            @JvmField var sNewInterfaceLoader: InterfaceLoader = sDefaultInterfaceLoader.getImplementation(InterfaceLoader::class.java)

            @JvmStatic @Synchronized fun  getImplementation(clazz: Class): T {
                var implementation: T

                implementation = sNewInterfaceLoader.getImplementation(clazz)

                if (implementation == null) {
                    implementation = sDefaultInterfaceLoader.getImplementation(clazz)
                }

                return implementation!!
            }
        }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy