All Projects → JLLeitschuh → kotlin-guiced

JLLeitschuh / kotlin-guiced

Licence: MIT license
Convenience Kotlin API over the Google Guice DI Library

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to kotlin-guiced

Slice
Slice - a framework which simplifies Sling/AEM development by using dependency injection pattern and mapping Sling resources into Java objects
Stars: ✭ 64 (+276.47%)
Mutual labels:  dependency-injection, guice, google-guice
noicejs
extremely thin async dependency injection
Stars: ✭ 16 (-5.88%)
Mutual labels:  dependency-injection, guice
google-guice-tutorials
4 part tutorial series on Google Guice
Stars: ✭ 28 (+64.71%)
Mutual labels:  dependency-injection, google-guice
Katana
Lightweight, minimalistic dependency injection library for Kotlin & Android
Stars: ✭ 181 (+964.71%)
Mutual labels:  jvm, dependency-injection
ThinkRchive
An app showing all details for various Lenovo Thinkpad models. Made to try out Jepack Compose for Android.
Stars: ✭ 84 (+394.12%)
Mutual labels:  dependency-injection
Gakko
Gakko - The Classroom App
Stars: ✭ 14 (-17.65%)
Mutual labels:  dependency-injection
gchisto
GC日志分析工具,网上不容易找到源码,这里备份一个。不确定工具是否正确,不确定是否有时间研究。
Stars: ✭ 32 (+88.24%)
Mutual labels:  jvm
StartupModules
Startup modules for ASP.NET Core.
Stars: ✭ 33 (+94.12%)
Mutual labels:  dependency-injection
styx
Programmable, asynchronous, event-based reverse proxy for JVM.
Stars: ✭ 250 (+1370.59%)
Mutual labels:  jvm
simple-dijs
Simple Javascript Dependency Injection Container (DI) like Pimple, well tested browser/node - callbacks compatible Simple Javascript Dependency Injection Container (DI) like Pimple, well tested browser/node - ES6 Arrow Functions compatible
Stars: ✭ 18 (+5.88%)
Mutual labels:  dependency-injection
jstackSeries.sh
Script for capturing a series of thread dumps from a Java process using jstack (on Linux and Windows)
Stars: ✭ 28 (+64.71%)
Mutual labels:  jvm
sconfig
Scala configuration library supporting HOCON for Scala, Java, Scala.js, and Scala Native
Stars: ✭ 99 (+482.35%)
Mutual labels:  jvm
dragome-sdk
Dragome is a tool for creating client side web applications in pure Java (JVM) language.
Stars: ✭ 79 (+364.71%)
Mutual labels:  jvm
gocontainer
Simple Dependency Injection Container
Stars: ✭ 18 (+5.88%)
Mutual labels:  dependency-injection
java-perf-workshop
Guided walkthrough to understand the performance aspects of a Java web service
Stars: ✭ 53 (+211.76%)
Mutual labels:  jvm
stashbox
A lightweight, fast, and portable dependency injection framework for .NET-based solutions.
Stars: ✭ 120 (+605.88%)
Mutual labels:  dependency-injection
sector
Simple Injector; Dependency Injection
Stars: ✭ 12 (-29.41%)
Mutual labels:  dependency-injection
guice-validator
Guice javax.validation method validation integration
Stars: ✭ 35 (+105.88%)
Mutual labels:  guice
WebApiClient.Extensions
WebApiClient项目的第三方扩展:Autofac、DependencyInjection、HttpClientFactory、SteeltoeOSS.Discovery、MessagePack、Protobuf、Json-Rpc
Stars: ✭ 73 (+329.41%)
Mutual labels:  dependency-injection
Autofac.Extras.NLog
An Autofac module to integrate Autofac and NLog, it supports both constructor and property injection.
Stars: ✭ 48 (+182.35%)
Mutual labels:  dependency-injection

Kotlin Guiced

Build Status Download

A Kotlin API wrapper over the Google Guice Dependency Injection library.

This library aims to encourage the use of Guice with Kotlin by simplifying the Guice API so it is more fluent in the Kotlin programming language.

NOTE:

Project is in very early stage of development. I plan to add helper functions as needed in a parallel cooperate internal project and this project it may not comprehensively cover all of the methods out of the box.

Examples:

TypeLiteral

Because of java type erasure, Guice uses some strange java syntax to preserve type at runtime. Many of these problems have been solved by Kotlin using inline functions with reified types.

In java you can declare a type literal with:

final TypeLiteral<Map<Integer, String>> someLiteral = new TypeLiteral<Map<Integer, String>>() {}

In Kotlin this syntax becomes even more verbose requiring more characters to write.

val someLiteral = object : TypeLiteral<Map<Integer, String>>() {}

This library provides helpers like the one below that is much cleaner to read.

val someLiteral = typeLiteral<Map<Int, String>>()

Guice Modules

Creating a module in Java requires quite a bit of extra boilerplate.

public class MyModule extends AbstractModule {
    @Override
    void configure() {
        bind(SomeService.class).to(SomeServiceImpl.class);
    }
}

class Main {
    public static void main(String... args) {
        final Injector injector = Guice.createInjector(new MyModule());
    }
}

This is the equivalent in Kotlin:

fun main(vararg args: String) {
    val myModule = module {
        bind(SomeService::class).to(SomeServiceImpl::class)
        // Or, even simpler with reified generics
        bind<SomeService>().to<SomeServiceImpl>()
    }
    val injector = Guice.createInjector(myModule)
}

The library also defines a simple way of declaring private modules:

fun main(vararg args: String) {
    val privateModule = privateModule {
        bind<SomeService>().to<SomeServiceImpl>()
        expose<SomeService>()
    }
    val injector = Guice.createInjector(privateModule)
}

Project Structure

The intention is to structure this project such that Guice Core and each of it's respective extensions will be in their own projects. The reasoning being that a library consumer can choose to depend upon only the Guice extensions they need an not get a transitive dependency on a Guice extention they don't need.

Developers

Requirements

Requires JDK 8 installed (Kotlin Compiler compiles to JDK 6 bytecode but requires JDK 8 to run).

Building

This project uses Gradle to build/test/deploy code. Run ./gradlew tasks to se the various tasks this project supports.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].