/** * Deletes a property from this DBProperties object. * @param key * @return whether a property with matching key existed and was removed, or false if the key * was null * @throws IndexException */ public boolean removeProperty(String key) throws IndexException { if (key != null) { DBProperty existing= DBProperty.search(this.db, this.index, key); if (existing != null) { this.index.delete(existing.getRecord()); existing.delete(); return true; } } return false; }
/** * Deletes a property from this DBProperties object. * @param key * @return whether a property with matching key existed and was removed, or false if the key * was null * @throws IndexException */ public boolean removeProperty(String key) throws IndexException { if (key != null) { DBProperty existing= DBProperty.search(this.db, this.index, key); if (existing != null) { this.index.delete(existing.getRecord()); existing.delete(); return true; } } return false; }
/** * Writes the key, value mapping to the properties. If a mapping for the * same key already exists, it is overwritten. * @param key a non-null property name * @param value a value to associate with the key. may not be null. * @throws IndexException * @throws NullPointerException if key is null */ public void setProperty(String key, String value) throws IndexException { removeProperty(key); DBProperty newProperty= new DBProperty(this.db, key, value); this.index.insert(newProperty.getRecord()); }
/** * Writes the key, value mapping to the properties. If a mapping for the * same key already exists, it is overwritten. * @param key a non-null property name * @param value a value to associate with the key. may not be null. * @throws IndexException * @throws NullPointerException if key is null */ public void setProperty(String key, String value) throws IndexException { removeProperty(key); DBProperty newProperty= new DBProperty(this.db, key, value); this.index.insert(newProperty.getRecord()); }