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

Method getBackLinkFieldName

src/src/com/orm/androrm/Model.java:164–187  ·  view source on GitHub ↗
(
			
			Class<O> originClass,
			Class<T> targetClass
			
	)

Source from the content-addressed store, hash-verified

162 }
163
164 public static final <O extends Model, T extends Model> String getBackLinkFieldName(
165
166 Class<O> originClass,
167 Class<T> targetClass
168
169 ) {
170
171 Field fk = null;
172
173 try {
174 fk = getForeignKeyField(targetClass, originClass, getInstace(originClass));
175 } catch (IllegalAccessException e) {
176 Log.e(TAG, "an exception has been thrown trying to gather the foreign key field pointing to "
177 + targetClass.getSimpleName()
178 + " from origin class "
179 + originClass.getSimpleName(), e);
180 }
181
182 if(fk != null) {
183 return fk.getName();
184 }
185
186 return null;
187 }
188
189 private static final <T extends Model> List<String> getEligableFields(
190

Callers 3

getRelationSelectionMethod · 0.95
unwrapOneToManyFieldMethod · 0.95
getMethod · 0.95

Calls 3

getForeignKeyFieldMethod · 0.95
getInstaceMethod · 0.95
getNameMethod · 0.45

Tested by

no test coverage detected