// Path: sample/src/main/java/com/example/flow/mortar/DaggerService.java
// public class DaggerService {
// 
//     public static final String SERVICE_NAME = DaggerService.class.getName();
// 
//     /**
//      * Caller is required to know the type of the component for this context.
//      */
//     @SuppressWarnings("unchecked") //
//     public static <T> T getDaggerComponent(Context context) {
//         return (T) context.getSystemService(SERVICE_NAME);
//     }
// }
// 
// Path: sample/src/main/java/com/example/flow/rest/RestClient.java
// @Singleton
// public class RestClient {
// 
//     private Service service;
// 
//     @Inject
//     public RestClient() {
// 
//         Gson gson = new GsonBuilder().create();
// 
//         RestAdapter restAdapter = new RestAdapter.Builder()
//                 .setLogLevel(RestAdapter.LogLevel.BASIC)
//                 .setEndpoint("http://jsonplaceholder.typicode.com/")
//                 .setConverter(new GsonConverter(gson))
//                 .build();
// 
//         service = restAdapter.create(Service.class);
//     }
// 
//     public Service getService() {
//         return service;
//     }
// }


import android.app.Application;
import android.content.Context;
import com.example.flow.BuildConfig;
import com.example.flow.mortar.DaggerService;
import com.example.flow.rest.RestClient;
import javax.inject.Singleton;
import dagger.Provides;
import mortar.MortarScope;
import timber.log.Timber;
package com.example.flow.app;





public class App extends Application {

    private MortarScope mortarScope;

    @Override
    public Object getSystemService(String name) {
        return mortarScope.hasService(name) ? mortarScope.getService(name) : super.getSystemService(name);
    }

    @Override
    public void onCreate() {
        super.onCreate();

        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }

        Component component = DaggerApp_Component.builder()
                .module(new Module())
                .build();
        component.inject(this);

        mortarScope = MortarScope.buildRootScope()
                .withService(DaggerService.SERVICE_NAME, component)
                .build("Root");
    }


    @dagger.Component(modules = Module.class)
    @Singleton
    public interface Component {

// Path: sample/src/main/java/com/example/flow/mortar/DaggerService.java
// public class DaggerService {
// 
//     public static final String SERVICE_NAME = DaggerService.class.getName();
// 
//     /**
//      * Caller is required to know the type of the component for this context.
//      */
//     @SuppressWarnings("unchecked") //
//     public static <T> T getDaggerComponent(Context context) {
//         return (T) context.getSystemService(SERVICE_NAME);
//     }
// }
// 
// Path: sample/src/main/java/com/example/flow/rest/RestClient.java
// @Singleton
// public class RestClient {
// 
//     private Service service;
// 
//     @Inject
//     public RestClient() {
// 
//         Gson gson = new GsonBuilder().create();
// 
//         RestAdapter restAdapter = new RestAdapter.Builder()
//                 .setLogLevel(RestAdapter.LogLevel.BASIC)
//                 .setEndpoint("http://jsonplaceholder.typicode.com/")
//                 .setConverter(new GsonConverter(gson))
//                 .build();
// 
//         service = restAdapter.create(Service.class);
//     }
// 
//     public Service getService() {
//         return service;
//     }
// }


// Path: sample/src/main/java/com/example/flow/app/App.java
import android.app.Application;
import android.content.Context;
import com.example.flow.BuildConfig;
import com.example.flow.mortar.DaggerService;
import com.example.flow.rest.RestClient;
import javax.inject.Singleton;
import dagger.Provides;
import mortar.MortarScope;
import timber.log.Timber;

package com.example.flow.app;





public class App extends Application {

    private MortarScope mortarScope;

    @Override
    public Object getSystemService(String name) {
        return mortarScope.hasService(name) ? mortarScope.getService(name) : super.getSystemService(name);
    }

    @Override
    public void onCreate() {
        super.onCreate();

        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }

        Component component = DaggerApp_Component.builder()
                .module(new Module())
                .build();
        component.inject(this);

        mortarScope = MortarScope.buildRootScope()
                .withService(DaggerService.SERVICE_NAME, component)
                .build("Root");
    }


    @dagger.Component(modules = Module.class)
    @Singleton
    public interface Component {

        RestClient restClient();