Skip to content
A simple Kotlin multi-platform abstraction around the javax.inject annotations.
Kotlin
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Updated publish Github Action to run on release Jan 14, 2020
gradle/wrapper Initial Commit Jan 8, 2020
src Added default javax.inject comments to the Kotlin common components Jan 13, 2020
.gitignore Initial Commit Jan 8, 2020
LICENSE
README.md Corrected date in README file Jan 14, 2020
build.gradle
gradle.properties Initial Commit Jan 8, 2020
gradlew Initial Commit Jan 8, 2020
gradlew.bat Initial Commit Jan 8, 2020
settings.gradle Initial Commit Jan 8, 2020

README.md

Inject

A simple Kotlin multi-platform abstraction around the javax.inject annotations. This allows using the annotations in Kotlin common code so that platform specific annotation processors can register them.

For more information about the library, refer to the blog post here which was featured in Android Weekly issue #396. Badge

Building the library

The library is provided through Github Packages. Checkout the releases package to get the latest version.

Repository

repositories {
    maven {
        url = uri("https://maven.pkg.github.com/chrynan/inject")
    }
}

Dependencies

Kotlin Common:

implementation("com.chrynan.inject:inject-common:VERSION")

Kotlin JVM:

implementation("com.chrynan.inject:inject-jvm:VERSION")

Kotlin JS:

implementation("com.chrynan.inject:inject-js:VERSION")

Using the library

Simply use the provided annotations just as you would use the javax.inject annotations.

For example, using the Inject annotation on a constructor in Kotlin Common code:

class MyUseCase @Inject constructor() { ... }

Available annotations and interfaces

  • @Inject
  • @Named("name")
  • @Qualifier
  • @Scope
  • @Singleton
  • Provider<T>

License

Copyright 2020 chRyNaN

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

The javax.inject library is also licensed under the Apache License 2.0.

You can’t perform that action at this time.