package com.getbase.android.autoprovider;

import com.google.common.collect.ImmutableBiMap;

import org.chalup.thneed.ModelGraph;
import org.chalup.thneed.ModelVisitor;
import org.chalup.thneed.models.DatabaseModel;
import org.chalup.thneed.models.PojoModel;

public final class ClassToTable<TModel extends DatabaseModel & PojoModel> {

  private static <TModel extends DatabaseModel & PojoModel> ImmutableBiMap<Class<?>, String> buildClassToTableMap(ModelGraph<TModel> modelGraph) {
    final ImmutableBiMap.Builder<Class<?>, String> classToTableMappingBuilder = ImmutableBiMap.builder();
    modelGraph.accept(new ModelVisitor<TModel>() {
      @Override
      public void visit(TModel model) {
        classToTableMappingBuilder.put(model.getModelClass(), model.getTableName());
      }
    });
    return classToTableMappingBuilder.build();
  }

  private final ImmutableBiMap<Class<?>, String> mClassToTableBiMap;

  public ClassToTable(ModelGraph<TModel> modelModelGraph) {
    mClassToTableBiMap = buildClassToTableMap(modelModelGraph);
  }

  public String getTableForClass(Class<?> klass) {
    return mClassToTableBiMap.get(klass);
  }

  public Class<?> getClassForTable(String table) {
    return mClassToTableBiMap.inverse().get(table);
  }

  public boolean hasClass(Class<?> klass) {
    return mClassToTableBiMap.containsKey(klass);
  }

  public boolean hasTable(String table) {
    return mClassToTableBiMap.containsValue(table);
  }
}

@@ -127,47 +127,8 @@
 ph;%0A
-import org.chalup.thneed.ModelVisitor;%0A
 impo
@@ -170,16 +170,16 @@
 eModel;%0A
+
 import o
@@ -294,522 +294,8 @@
 %3E %7B%0A
-%0A  private static %3CTModel extends DatabaseModel & PojoModel%3E ImmutableBiMap%3CClass%3C?%3E, String%3E buildClassToTableMap(ModelGraph%3CTModel%3E modelGraph) %7B%0A    final ImmutableBiMap.Builder%3CClass%3C?%3E, String%3E classToTableMappingBuilder = ImmutableBiMap.builder();%0A    modelGraph.accept(new ModelVisitor%3CTModel%3E() %7B%0A      @Override%0A      public void visit(TModel model) %7B%0A        classToTableMappingBuilder.put(model.getModelClass(), model.getTableName());%0A      %7D%0A    %7D);%0A    return classToTableMappingBuilder.build();%0A  %7D%0A%0A
   pr
@@ -416,24 +416,24 @@
 delGraph) %7B%0A
-
     mClassTo
@@ -445,16 +445,22 @@
 BiMap = 
+Utils.
 buildCla

Remove duplicated code