public class MapDBContext extends Object implements DBContext
DBContext that relies on a DB.| Constructor and Description |
|---|
MapDBContext(org.mapdb.DB db) |
| Modifier and Type | Method and Description |
|---|---|
Object |
backup()
Implementations of this method are free to return any object such as XML, JSON, etc...
|
void |
clear()
Clears the data structures present in the database.
|
void |
close() |
void |
commit()
Commits the database to its persistent layer.
|
boolean |
contains(String name) |
<T> List<T> |
getList(String name) |
<K,V> Map<K,V> |
getMap(String name) |
<T> Set<T> |
getSet(String name) |
String |
info(String name) |
static DBContext |
offlineInstance(String name)
This DB returned by this method gets deleted on JVM shutdown.
|
static DBContext |
onlineInstance(String name)
This DB returned by this method does not trigger deletion on JVM shutdown.
|
boolean |
recover(Object backup)
The object passed to this method need to conform to the implementation of the
DBContext.backup() method. |
String |
summary() |
public static DBContext onlineInstance(String name)
name - name of the DB fileMapDBContextpublic static DBContext offlineInstance(String name)
name - name of the DB fileMapDBContextpublic String summary()
public Object backup()
DBContextpublic boolean recover(Object backup)
DBContextDBContext.backup() method.public void commit()
DBContextpublic void clear()
DBContextThis method does not delete the data-structure themselves, but leaves them empty.
public boolean contains(String name)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2017. All rights reserved.