@Test public void differentIdsForDifferentChildrenOfItemBinding() { final Context context = RuntimeEnvironment.application.getBaseContext(); final BindDefinition1 bindDefinition1 = new BindDefinition1(context); final BindDefinition2 bindDefinition2 = new BindDefinition2(context); final int id1 = bindDefinition1.getId(mContext); final int id2 = bindDefinition2.getId(mContext); assertThat(id1).isNotEqualTo(id2); }
public synchronized int getId(Context context) { final Class thisClass = this.getClass(); if (CLASS_ID_MAP.containsKey(thisClass)){ return CLASS_ID_MAP.get(thisClass); } final int id = ID_CREATOR.getId(); CLASS_ID_MAP.put(thisClass, id); return id; }
BindDefinition { public synchronized int getId(Context context) { final Class thisClass = this.getClass(); if (CLASS_ID_MAP.containsKey(thisClass)){ return CLASS_ID_MAP.get(thisClass); } final int id = ID_CREATOR.getId(); CLASS_ID_MAP.put(thisClass, id); return id; } }
BindDefinition { public synchronized int getId(Context context) { final Class thisClass = this.getClass(); if (CLASS_ID_MAP.containsKey(thisClass)){ return CLASS_ID_MAP.get(thisClass); } final int id = ID_CREATOR.getId(); CLASS_ID_MAP.put(thisClass, id); return id; } BindDefinition(final Context context); }
BindDefinition { public synchronized int getId(Context context) { final Class thisClass = this.getClass(); if (CLASS_ID_MAP.containsKey(thisClass)){ return CLASS_ID_MAP.get(thisClass); } final int id = ID_CREATOR.getId(); CLASS_ID_MAP.put(thisClass, id); return id; } BindDefinition(final Context context); Context getContext(); void onUnBind(final Context context); String[] getProjection(final Context context); String getSelection(final Context context); String[] getSelectionArguments(final Context context); String getSortOrder(final Context context); abstract void onBind(final Context context, final Cursor cursor); abstract Uri getUri(final Context context); synchronized int getId(Context context); void rebind(); void setManager(final BindingManager bindingManager); void setManager(final SupportBindingManager supportBindingManager); }
BindDefinition { public synchronized int getId(Context context) { final Class thisClass = this.getClass(); if (CLASS_ID_MAP.containsKey(thisClass)){ return CLASS_ID_MAP.get(thisClass); } final int id = ID_CREATOR.getId(); CLASS_ID_MAP.put(thisClass, id); return id; } BindDefinition(final Context context); Context getContext(); void onUnBind(final Context context); String[] getProjection(final Context context); String getSelection(final Context context); String[] getSelectionArguments(final Context context); String getSortOrder(final Context context); abstract void onBind(final Context context, final Cursor cursor); abstract Uri getUri(final Context context); synchronized int getId(Context context); void rebind(); void setManager(final BindingManager bindingManager); void setManager(final SupportBindingManager supportBindingManager);  }