Shelf

Additional

Language
Java
Version
N/A
Created
Jan 31, 2017
Updated
Apr 18, 2017 (Retired)
Owner
Bloder (bloderxd)
Contributor
Bloder (bloderxd)
1
Activity
Badge
Generate
Download
Source code

Announcement

Shelf

Shelf is an easy way to implement repository pattern.

But how?

Add @Locker on your repositories and create a fixture and production implementations for them. in fixture implementation add the annotation @Prod. Build the project and be happy! ????@Fake and in production implementation add the annotation


Example

Locker

@Locker
public interface Test {

    void test();
}

Fake

@Fake
public class TestFake implements Test {

    @Override
    public void test() {

    }
}

Prod

@Prod
public class TestProd implements Test {

    @Override
    public void test() {

    }
}
You can call your repository with this:


Fake call
Shelf.forTest().withFake().test();

Import

First, import apt classpath in your project gradle file

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 

Then import shelf deppendencies in your app gradle file

apply plugin: 'com.neenbedankt.android-apt'

dependencies {
    compile 'com.bloder.shelf:core:1.0'
    apt 'com.bloder.shelf:compiler:1.0'
}