Reviewed the interface SikevaDB (Javadoc, remove->rename…).

This commit is contained in:
Christian P. MOMON 2018-02-28 10:58:41 +01:00
parent eaacc3a3d6
commit d40ee6acb4

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
* *
* This file is part of SikevaDB, simple key value database. * This file is part of SikevaDB, simple key value database.
* *
@ -21,73 +21,349 @@ package fr.devinsy.sikevadb.core;
import fr.devinsy.util.strings.StringList; import fr.devinsy.util.strings.StringList;
/** /**
* * The Interface SikevaDB.
* *
* @author Christian Pierre MOMON * @author Christian Pierre MOMON
*/ */
public interface SikevaDB public interface SikevaDB
{ {
/**
* Delete all elements of current opened database.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
public void clear() throws SikevaDBException; public void clear() throws SikevaDBException;
/**
* Close the current database session.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
public void close() throws SikevaDBException; public void close() throws SikevaDBException;
/**
* Count of elements in current database.
*
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long countOfElements() throws SikevaDBException; public long countOfElements() throws SikevaDBException;
/**
* Count of elements by key.
*
* @param key
* the key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long countOfElements(String key) throws SikevaDBException; public long countOfElements(String key) throws SikevaDBException;
/**
* Count of elements by key and subkey.
*
* @param key
* the key
* @param subkey
* the subkey
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long countOfElements(String key, String subkey) throws SikevaDBException; public long countOfElements(String key, String subkey) throws SikevaDBException;
/**
* Creates the database.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
public void create() throws SikevaDBException; public void create() throws SikevaDBException;
/**
* Removes the.
*
* @param key
* the key
* @throws SikevaDBException
* the SikevaDB exception
*/
void delete(final String key) throws SikevaDBException;
/**
* Delete.
*
* @param key
* the key
* @param subkey
* the subkey
* @throws SikevaDBException
* the SikevaDB exception
*/
void delete(final String key, final String subkey) throws SikevaDBException;
/**
* Delete many.
*
* @param key
* the key
* @param subkeys
* the subkeys
* @throws SikevaDBException
* the SikevaDB exception
*/
void deleteMany(final String key, final String... subkeys) throws SikevaDBException;
/**
* Gets an element by key.
*
* @param key
* the key
* @return the element
* @throws SikevaDBException
* the SikevaDB exception
*/
public Element getElement(String key) throws SikevaDBException; public Element getElement(String key) throws SikevaDBException;
/**
* Gets an element by key and sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the element
* @throws SikevaDBException
* the SikevaDB exception
*/
public Element getElement(String key, String subkey) throws SikevaDBException; public Element getElement(String key, String subkey) throws SikevaDBException;
/**
* Gets all elements in current database.
*
* @return the elements
* @throws SikevaDBException
* the SikevaDB exception
*/
public Elements getElements() throws SikevaDBException; public Elements getElements() throws SikevaDBException;
/**
* Gets all elements of a top key.
*
* @param key
* the key
* @return the elements
* @throws SikevaDBException
* the SikevaDB exception
*/
public Elements getElements(String key) throws SikevaDBException; public Elements getElements(String key) throws SikevaDBException;
public fr.devinsy.util.strings.StringList getKeys() throws SikevaDBException; /**
* Gets all the top keys.
*
* @return the keys
* @throws SikevaDBException
* the SikevaDB exception
*/
public StringList getKeys() throws SikevaDBException;
/**
* Gets all the sub keys of a key.
*
* @param key
* the key
* @return the subkeys
* @throws SikevaDBException
* the SikevaDB exception
*/
public StringList getSubkeys(String key) throws SikevaDBException; public StringList getSubkeys(String key) throws SikevaDBException;
/**
* Gets the value of a key.
*
* @param key
* the key
* @return the value
* @throws SikevaDBException
* the SikevaDB exception
*/
public String getValue(String key) throws SikevaDBException; public String getValue(String key) throws SikevaDBException;
/**
* Gets the value of a key and a sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the value
* @throws SikevaDBException
* the SikevaDB exception
*/
public String getValue(String key, String subkey) throws SikevaDBException; public String getValue(String key, String subkey) throws SikevaDBException;
/**
* Gets the values of a key.
*
* @param key
* the key
* @return the values
* @throws SikevaDBException
* the SikevaDB exception
*/
public StringList getValues(String key) throws SikevaDBException; public StringList getValues(String key) throws SikevaDBException;
/**
* Checks if is closed.
*
* @return true, if is closed
*/
public boolean isClosed(); public boolean isClosed();
/**
* Checks if is created.
*
* @return true, if is created
* @throws SikevaDBException
* the SikevaDB exception
*/
public boolean isCreated() throws SikevaDBException; public boolean isCreated() throws SikevaDBException;
/**
* Checks if is opened.
*
* @return true, if is opened
*/
public boolean isOpened(); public boolean isOpened();
/**
* Returns the memory size of the elements in database.
*
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long memorySize() throws SikevaDBException; public long memorySize() throws SikevaDBException;
/**
* Returns the memory size of elements of a key.
*
* @param key
* the key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long memorySize(String key) throws SikevaDBException; public long memorySize(String key) throws SikevaDBException;
/**
* Returns the memory size of element of a key and a sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long memorySize(String key, String subkey) throws SikevaDBException; public long memorySize(String key, String subkey) throws SikevaDBException;
/**
* Open a database.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
void open() throws SikevaDBException; void open() throws SikevaDBException;
/**
* Put an element in database.
*
* @param element
* the element
* @throws SikevaDBException
* the SikevaDB exception
*/
void put(Element element) throws SikevaDBException; void put(Element element) throws SikevaDBException;
/**
* Put a value for a key in current opened database.
*
* @param key
* the key
* @param value
* the value
* @throws SikevaDBException
* the SikevaDB exception
*/
void put(String key, String value) throws SikevaDBException; void put(String key, String value) throws SikevaDBException;
/**
* Put a value for a key and a sub key in current opened database.
*
* @param key
* the key
* @param subkey
* the subkey
* @param value
* the value
* @throws SikevaDBException
* the SikevaDB exception
*/
void put(String key, String subkey, String value) throws SikevaDBException; void put(String key, String subkey, String value) throws SikevaDBException;
void remove(final String key) throws SikevaDBException; /**
* Rename a key.
void remove(final String key, final String subkey) throws SikevaDBException; *
* @param oldKey
void removeMany(final String key, final String... subkeys) throws SikevaDBException; * the old key
* @param newKey
* the new key
* @throws SikevaDBException
* the SikevaDB exception
*/
void renameKey(final String oldKey, final String newKey) throws SikevaDBException; void renameKey(final String oldKey, final String newKey) throws SikevaDBException;
/**
* Rename a sub key.
*
* @param key
* the key
* @param oldSubKey
* the old sub key
* @param newSubKey
* the new sub key
* @throws SikevaDBException
* the SikevaDB exception
*/
void renameSubKey(final String key, final String oldSubKey, final String newSubKey) throws SikevaDBException; void renameSubKey(final String key, final String oldSubKey, final String newSubKey) throws SikevaDBException;
/**
* Replace a substring in a value of a key.
*
* @param key
* the key
* @param tokens
* the tokens
* @throws SikevaDBException
* the SikevaDB exception
*/
void replaceInValue(final String key, final String... tokens) throws SikevaDBException; void replaceInValue(final String key, final String... tokens) throws SikevaDBException;
/**
* Replace a substring in values of all sub keys of a key.
*
* @param key
* the key
* @param tokens
* the tokens
* @throws SikevaDBException
* the SikevaDB exception
*/
void replaceInValues(final String key, final String... tokens) throws SikevaDBException; void replaceInValues(final String key, final String... tokens) throws SikevaDBException;
} }