Flavor - A lightweight Kotlin dependency injection & service management framework.

Related tags

Code examples flavor
Overview

flavor

A light-weight kotlin dependency injection & service management framework.

  • Flavor is based around guice's design.

Usage:

Creating a Flavor instance:

val flavor = Flavor.create<FlavorTest>()

Binding a class to an instance:

flavor.bind<SomeObject>()
    .scoped(InjectScope.SINGLETON)
    .annotated<Named> {
        it.value == "horsie"
    }
    .to(someObjectInstance)

An example of a Flavor service:

@Service
// @IgnoreAutoScan - if you do not want Flavor to 
// automatically register this service
object SomeService
{
    @Inject @Named("SomethingString")
    lateinit var something: String
    
    @Configure
    fun configure()
    {
        // this method is invoked once all 
        // fields have been injected!
    }
}

Your Flavor instance can be started using:

flavor.startup()

and stopped using:

flavor.close()
  • NOTE: Flavor automatically iterates through each class in the base package of the registration class, registers any available service, and injects all fields which need injection.
gg.scala.flavor.FlavorTest - registration class
gg.scala.flavor - package which flavor will scan

⚠️ There is currently no way to disable automatic scanning.

Compilation:

./gradlew build
You might also like...
Starter code for the first independent project for Android Basics in Kotlin

Project: Lemonade App - Starter Code Starter code for the first independent project for Android Basics in Kotlin Introduction This is the starter code

Starter code for Android Kotlin Fundamentals Codelab 7.4 Interacting with RecyclerView items

TrackMySleepQuality with RecyclerView - Starter Code for 7.4 Starter code for Android Kotlin Fundamentals Codelab 7.4 Interacting with RecyclerView it

ROOM Database Example with MVVM in Kotlin[Fragments,Navigation]

RoomDatabase_SampleApp Room Database Sample App Overview Of This Room Database Application In this app, we can do operation on room database | Insert,

Gods Unchained Demo With Kotlin
Gods Unchained Demo With Kotlin

Gods Unchained Demo This app allows you to view a page of Gods Unchained cards and highlight a specific one to see a larger version in Shadow quality

ListView Example with custom Adapter Using Kotlin in Android Studio
ListView Example with custom Adapter Using Kotlin in Android Studio

Kotlin-ListView ListView Example with custom Adapter Using Kotlin in Android Studio Steps to follow : Build ListView with Custom Adapter in Kotlin Add

Starter code for the second independent project for Android Basics in Kotlin.

Dogglers - Starter Code Starter code for the second independent project for Android Basics in Kotlin. Introduction This is the starter code for the Do

Starter code for the second independent project for Android Basics in Kotlin

Dogglers - Starter Code Starter code for the second independent project for Android Basics in Kotlin. Introduction This is the starter code for the Do

Fotos de marte - Ejercicio unidad 4 (Android Basics with Kotlin)

MarsPhotos - Starter Code Starter code for Android Basics in Kotlin. Introduction Using this stater code you will create MarsPhotos is a demo app that

Android Trivia Starter With Kotlin

AndroidTriviaFragment - solution code This app is the solution code for Android Kotlin Fundamentals codelab 3.1: Create and add a fragment. The app is

Releases(0.1.2)
  • 0.1.2(Jan 12, 2022)

    Changelog:

    • Reworked class scanner (@devrawr)
    • Tested service functionality on a production environment (@GrowlyX)
    • Setup a JUnit testing environment (@GrowlyX)
    • Create methods to automatically create & inject into a class, with optional constructor parameters (@GrowlyX)

    Get it now on jitpack!

    Full Changelog: https://github.com/GrowlyX/flavor/compare/0.1.1...0.1.2

    Source code(tar.gz)
    Source code(zip)
Owner
Subham
Subham
MVVM(Model View ViewModel) sample in Kotlin using the components ViewModel, LiveData and Retrofit library

kotlin-mvvm Languages: English, Spanish MVVM(Model View ViewModel) sample in Kotlin using the components ViewModel, LiveData, the libraries Retrofit,

Eduardo José Medina Alfaro 466 Jan 5, 2023
Android Viper template with Kotlin, Dagger 2, Retrofit & RxJava

Android VIPER Architecture Example This repository contains a detailed sample client-server app that implements VIPER(View-Interactor-Presenter-Entity

OmiSoft 33 Nov 4, 2022
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.

Android Components Architecture in a Modular Word Android Components Architecture in a Modular Word is a sample project that presents modern, 2020 app

Madalin Valceleanu 2.3k Dec 30, 2022
💖组件化+Jetpack+Kotlin+MVVM项目实战,涉及Jetpack相关组件,Kotlin相关技术,协程+Retrofit,Paging3+Room等。

组件化+Jetpack+Kotlin+MVVM 一、项目简介 该项目主要以组件化+Jetpack+MVVM为架构,使用Kotlin语言,集合了最新的Jetpack组件,如Navigation、Paging3、Room等,另外还加上了依赖注入框架Koin和图片加载框架Coil。 网络请求部分使用OkH

fuusy 502 Dec 28, 2022
📌This repo contains the kotlin implementation of TensorflowLite Example Android Apps🚀

TensorflowLite Examples Kotlin This repo contains the kotlin implementation of TensorflowLite Example Apps here, which are mostly implemented in java

Sunit Roy 29 Jan 1, 2023
NotesApp is a project which demonstrates the power of Kotlin's Ktor in developing powerful REST APIs with all basic as well as advanced features.

NotesApp NotesApp is a project which demonstrates the power of Kotlin's Ktor in developing powerful REST APIs with all basic as well as advanced featu

Rooparsh Kalia 1 Oct 18, 2021
eCommerce app developed with Android Jetpack and Kotlin

garden-shed eCommerce app developed with Android Jetpack and Kotlin This is my first mobile application. Garden Shed is a simple application for buyin

null 2 Nov 1, 2022
This is the toy app for Lesson 9 of the Android App Development in Kotlin course on Udacity.

Behind the Scenes - DevByte Viewer App This is the toy app for Lesson 9 of the Android App Development in Kotlin course on Udacity. DevByte DevByte Vi

Jaime 1 Oct 20, 2021
An example Android Application to test out Kotlin development in Adndroid

AndroidDiceGenerator This is an example Android Application to test out Kotlin development in Adndroid. On pressing a button, the application generate

Fredrick Ojure 0 Oct 28, 2021
Quarkus Sample Application with extensions cache, kotlin, rest client, resteasy and smallrye

quarkus-sample Project This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, please visit its w

Erdem Aydın 1 Sep 25, 2022