protected String getCacheKeyForId(Object id) { // Because single-field id doesn't include target class name in toString() if (IdentityUtils.isSingleFieldIdentity(id)) { String targetClassName = ((SingleFieldId)id).getTargetClassName(); return cacheName + targetClassName + ":" + id.toString().hashCode(); } return cacheName + id.toString().hashCode(); } }
public static SingleFieldIdentity getSingleFieldIdentityForDataNucleusIdentity(SingleFieldId dnid, Class targetClass) { if (dnid instanceof LongId) { return new LongIdentity(targetClass, dnid.toString()); } else if (dnid instanceof IntId) { return new IntIdentity(targetClass, dnid.toString()); } else if (dnid instanceof ShortId) { return new ShortIdentity(targetClass, dnid.toString()); } else if (dnid instanceof ByteId) { return new ByteIdentity(targetClass, dnid.toString()); } else if (dnid instanceof StringId) { return new StringIdentity(targetClass, dnid.toString()); } else if (dnid instanceof CharId) { return new CharIdentity(targetClass, dnid.toString()); } return new ObjectIdentity(targetClass, dnid.getKeyAsObject()); }
protected String getCacheKeyForId(Object id) { // Because single-field id doesn't include target class name in toString() if (IdentityUtils.isSingleFieldIdentity(id)) { String targetClassName = ((SingleFieldId)id).getTargetClassName(); return cacheName + targetClassName + ":" + id.toString().hashCode(); } return cacheName + id.toString().hashCode(); } }
protected String getCacheKeyForId(Object id) { if (IdentityUtils.isSingleFieldIdentity(id)) { String targetClassName = ((SingleFieldId) id).getTargetClassName(); return cacheName + targetClassName + ":" + id.toString().hashCode(); } return cacheName + id.toString().hashCode(); } }