/** * Store an entity, preserving any existing keys if possible. If the combination of * existing and generated keys would produce a duplicate entry, replace all keys. */ private T create(final T object, final KeyElement keyElement) throws DataStoreException { synchronized (dataStore) { final boolean replaceKeys = dataStore.containsKey(keyElement); if (keyElement.keyValuesMissing() || replaceKeys) { KeyElement newKey = createSetAndGetKeys(object, replaceKeys); return this.create(object, newKey); } dataStore.put(keyElement, object); } return object; }
/** * Store an entity, preserving any existing keys if possible. If the combination of * existing and generated keys would produce a duplicate entry, replace all keys. */ private T create(final T object, final KeyElement keyElement) throws DataStoreException { synchronized (dataStore) { final boolean replaceKeys = dataStore.containsKey(keyElement); if (keyElement.keyValuesMissing() || replaceKeys) { KeyElement newKey = createSetAndGetKeys(object, replaceKeys); return this.create(object, newKey); } dataStore.put(keyElement, object); } return object; }
/** * Are the key values equal for both instances. * If all compared key values are <code>null</code> this also means equal. * * @param first first instance to check for key equal * @param second second instance to check for key equal * @return <code>true</code> if object instance have equal keys set. */ public boolean isKeyEqual(final T first, final T second) { KeyElement firstKeys = getKeys(first); KeyElement secondKeys = getKeys(second); return firstKeys.equals(secondKeys); }
/** * Are the key values equal for both instances. * If all compared key values are <code>null</code> this also means equal. * * @param first first instance to check for key equal * @param second second instance to check for key equal * @return <code>true</code> if object instance have equal keys set. */ public boolean isKeyEqual(final T first, final T second) { KeyElement firstKeys = getKeys(first); KeyElement secondKeys = getKeys(second); return firstKeys.equals(secondKeys); }
/** * Are the key values equal for both instances. * If all compared key values are <code>null</code> this also means equal. * * @param first first instance to check for key equal * @param second second instance to check for key equal * @return <code>true</code> if object instance have equal keys set. */ public boolean isKeyEqual(final T first, final T second) { KeyElement firstKeys = getKeys(first); KeyElement secondKeys = getKeys(second); return firstKeys.equals(secondKeys); }
private T create(final T object, final KeyElement keyElement) throws DataStoreException { synchronized (dataStore) { if (keyElement.keyValuesMissing() || dataStore.containsKey(keyElement)) { KeyElement newKey = createSetAndGetKeys(object); return this.create(object, newKey); } dataStore.put(keyElement, object); } return object; }