Exemplo n.º 1
0
 @SuppressWarnings("unchecked")
 protected Object getModelValue(Object inValue, String columnName) {
   ModelContainerAdapter<? extends Model> modelContainerAdapter =
       FlowManager.getContainerAdapter(getTable());
   Class<? extends Model> columnClass =
       (Class<? extends Model>) modelContainerAdapter.getClassForColumn(columnName);
   ModelContainerAdapter<? extends Model> columnAdapter =
       FlowManager.getContainerAdapter(columnClass);
   if (columnAdapter != null) {
     inValue = columnAdapter.toModel(getInstance(inValue, columnClass));
   } else {
     throw new RuntimeException(
         "Column: " + columnName + "'s class needs to add the @ContainerAdapter annotation");
   }
   return inValue;
 }
Exemplo n.º 2
0
 public BaseModelContainer(Class<ModelClass> table) {
   modelAdapter = FlowManager.getModelAdapter(table);
   modelContainerAdapter = FlowManager.getContainerAdapter(table);
   if (modelContainerAdapter == null) {
     throw new InvalidDBConfiguration(
         "The table "
             + FlowManager.getTableName(table)
             + " did not specify the "
             + com.raizlabs.android.dbflow.annotation.ModelContainer.class.getSimpleName()
             + " annotation."
             + " Please decorate "
             + table.getName()
             + " with annotation @"
             + com.raizlabs.android.dbflow.annotation.ModelContainer.class.getSimpleName()
             + ".");
   }
 }