use of com.orm.androrm.field.DataField in project androrm by androrm.
the class DatabaseBuilder method getFieldDefinitions.
private static final <T extends Model> void getFieldDefinitions(T instance, Class<T> clazz, TableDefinition modelTable) throws IllegalArgumentException, IllegalAccessException {
if (clazz != null && clazz.isInstance(instance)) {
ModelCache.addModel(clazz);
for (Field field : getFields(clazz, instance)) {
String name = field.getName();
Object o = field.get(instance);
if (o instanceof DataField) {
DataField<?> fieldObject = (DataField<?>) o;
modelTable.addField(name, fieldObject);
}
if (o instanceof ManyToManyField) {
modelTable.addRelationalClass(clazz);
}
}
getFieldDefinitions(instance, Model.getSuperclass(clazz), modelTable);
}
}
Aggregations