Toothpick

Additional

Language
Java
Version
1.0.3 (Dec 19, 2016)
Created
Mar 28, 2016
Updated
Mar 25, 2017
Owner
stephanenicolas
Contributors
ligi
stephanenicolas
dlemures
eygraber
KazuCocoa
kelsos
6
Activity
Badge
Generate
Download
Source code
APK file

Advertising

#Toothpick (a.k.a T.P. like a teepee)






Visit TP wiki !

What is Toothpick ?

Toothpick is a scope tree based Dependency Injection (DI) library for Java.

It is a full-featured, runtime based, but reflection free, implementation of JSR 330.

What does Toothpick offer ?

//a typical Toothpick scope tree during the execution of an Android app.

       @ApplicationSingleton 
         /              |    \  
        /               |     \
       /                |      \
   @PresenterSingleton  |   Service 2
         /              | 
        /            Service 1  
       /            
Activity 1
    /   \
   /   Fragment 2
  /
Fragment 1

Toothpick is :

Hey, Android Devs, you can use TP to create MVP apps so easily !

Examples

Currently Toothpick has 2 sets of examples :

Setup

For Android :

#android setup using gradle 2.2.3
buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
  }
}

...

dependencies {
  compile 'com.github.stephanenicolas.toothpick:toothpick-runtime:1.0.6'
  // and for android -> compile 'com.github.stephanenicolas.toothpick:smoothie:1.0.6'
  annotationProcessor 'com.github.stephanenicolas.toothpick:toothpick-compiler:1.0.6'

  //highly recommended
  testCompile 'com.github.stephanenicolas.toothpick:toothpick-testing:1.0.6'
  testCompile 'mockito or easymock'
}

For java:

<!--java setup with maven -->
  <dependencies>
    <dependency>
      <groupId>com.github.stephanenicolas.toothpick</groupId>
      <artifactId>toothpick-compiler</artifactId>
      <version>1.0.6</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.github.stephanenicolas.toothpick</groupId>
      <artifactId>toothpick-runtime</artifactId>
      <version>1.0.6</version>
      <scope>compile</scope>
    </dependency>
    
    <!-- highly recommended-->
    <dependency> 
      <groupId>com.github.stephanenicolas.toothpick</groupId>
      <artifactId>toothpick-testing</artifactId>
      <version>1.0.6</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    <easymock or mockito>
    </dependency>
  </dependencies>

Talks

Wanna know more ?

Visit Toothpick's wiki !

Alternative Dependency Injection (DI) engines for Android