Shelf

General

Category
Free
Tag
Design Patterns
License
Apache License, Version 2.0
Min SDK
1 (Android 1.0)
Registered
Feb 2, 2017
Favorites
0
Link
https://github.com/bloderxd/Shelf
See also
Android MVP
Moxy
AndroidWizard
MVP Helpers
Jota

Additional

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

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 @Fake and in production implementation add the annotation
@Prod. Build the project and be happy! ????

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:
Prod call
Shelf.forTest().withProd().test();
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'
}