MCPcopy Create free account
hub / github.com/androrm/androrm / resolveLastField

Method resolveLastField

src/src/com/orm/androrm/QueryBuilder.java:235–264  ·  view source on GitHub ↗
(
			
			Object 		field, 
			Class<T> 	clazz, 
			Rule 		rule
			
	)

Source from the content-addressed store, hash-verified

233 }
234
235 private static final <T extends Model> SelectStatement resolveLastField(
236
237 Object field,
238 Class<T> clazz,
239 Rule rule
240
241 ) {
242
243 SelectStatement select = new SelectStatement();
244
245 if(DatabaseBuilder.isRelationalField(field)
246 && !(field instanceof ForeignKeyField)) {
247
248 Relation<?> r = (Relation<?>) field;
249
250 return getRelationSelection(r, clazz, rule);
251 }
252
253 String tableName = DatabaseBuilder.getTableName(clazz);
254
255 Where where = new Where();
256 where.setStatement(rule.getStatement());
257
258 select.from(tableName)
259 .distinct()
260 .select(Model.PK + " AS " + tableName)
261 .where(where);
262
263 return select;
264 }
265
266 private static final <T extends Model> SelectStatement resolveRelationField(
267

Callers 1

buildJoinMethod · 0.95

Calls 9

isRelationalFieldMethod · 0.95
getRelationSelectionMethod · 0.95
getTableNameMethod · 0.95
setStatementMethod · 0.95
fromMethod · 0.95
selectMethod · 0.80
getStatementMethod · 0.45
whereMethod · 0.45
distinctMethod · 0.45

Tested by

no test coverage detected