( T target, Class<T> targetClass, O origin, Class<O> originClass )
| 338 | } |
| 339 | |
| 340 | private static final <T extends Model, O extends Model> void setBackLink( |
| 341 | |
| 342 | T target, |
| 343 | Class<T> targetClass, |
| 344 | O origin, |
| 345 | Class<O> originClass |
| 346 | |
| 347 | ) throws NoSuchFieldException { |
| 348 | |
| 349 | ForeignKeyField<T> fk = null; |
| 350 | |
| 351 | try { |
| 352 | fk = getForeignKey(origin, originClass, targetClass); |
| 353 | } catch(IllegalAccessException e) { |
| 354 | Log.e(TAG, "an exception was thrown trying to gather a foreign key field pointing to " |
| 355 | + targetClass.getSimpleName() |
| 356 | + " on an instance of class " |
| 357 | + originClass.getSimpleName(), e); |
| 358 | } |
| 359 | |
| 360 | if(fk != null) { |
| 361 | fk.set(target); |
| 362 | } else { |
| 363 | throw new NoSuchFieldException("No field pointing to " |
| 364 | + targetClass.getSimpleName() |
| 365 | + " was found in class " |
| 366 | + originClass.getSimpleName() |
| 367 | +"! Choices are: " |
| 368 | + getEligableFields(originClass, origin).toString()); |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | public static <T extends Model> QuerySet<T> objects( |
| 373 |
no test coverage detected