| Modifier and Type | Interface and Description |
|---|---|
static class |
JsonCache.Root.MergePolicy
Describes cache behaviour when a load method is called for a cache instance that is already loaded.
|
JsonCache.CacheException, JsonCache.Factory, JsonCache.Root| Modifier and Type | Method and Description |
|---|---|
JsonCache.Root |
flush(File file)
If the cache is dirty, saves the object graph in JSON format to the specified file.
|
JsonCache.Root |
flush(OutputStream out)
If the cache is dirty, saves the object graph in JSON format to the specified stream.
|
JsonCache.Root |
flushOnShutdown(File file)
Makes a best-effort attempt to ensure that the cache gets flushed to a disk file if dirty on shutdown.
|
JsonCache.Root |
flushOnShutdown(OutputStream out)
Makes a best-effort attempt to ensure that the cache gets flushed to an output stream if dirty on shutdown.
|
com.fasterxml.jackson.databind.ObjectMapper |
getMapper()
Returns the mapper used for JSON-object marshalling and serialisation operations.
|
JsonCache.Root.MergePolicy |
getMergePolicy()
Returns the merge policy that applies when
load() is called on a cache that is already loaded. |
boolean |
isDirty()
Indicates whether the cached has unsaved changes.
|
JsonCache.Root |
load(File file)
Loads the cache from the specified file.
|
JsonCache.Root |
load(InputStream in)
Loads the cache from the specified stream.
|
JsonCache.Root |
mapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
Sets the mapper to use for JSON-object marshalling and serialisation operations.
|
JsonCache.Root |
mergePolicy(JsonCache.Root.MergePolicy policy)
Sets the merge policy that applies when
load() is called for a cache that is already loaded. |
JsonCache.Root |
save(File file)
Saves the object graph in JSON format to the specified file.
|
JsonCache.Root |
save(OutputStream out)
Saves the object graph in JSON format to the specified stream.
|
JsonCache.Root |
unload()
Unloads the object graph, setting the root node to
null. |
add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, child, child, delete, delete, exists, exists, get, get, get, get, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBigInteger, getBigInteger, getBinary, getBinary, getBinary, getBinary, getBoolean, getBoolean, getBoolean, getBoolean, getDouble, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getFloat, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNodeType, getNodeType, getNumber, getNumber, getNumber, getNumber, getObject, getObject, getObject, getObject, getObjects, getObjects, getObjects, getObjects, getShort, getShort, getShort, getShort, getString, getString, getString, getString, parent, root, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, size, sizeJsonCache.Root flush(File file) throws JsonCache.CacheException
file - The output file.JsonCache.CacheException - if the root node does not exist or if unable to create or write the file.NullPointerException - if file is null.flushOnShutdown(File),
save(File)JsonCache.Root flush(OutputStream out) throws JsonCache.CacheException
out - The output stream, which is closed before the method returns.JsonCache.CacheException - if the root node does not exist or if unable to create or write the file.NullPointerException - if out is null.flushOnShutdown(OutputStream),
save(OutputStream)JsonCache.Root flushOnShutdown(File file)
file - The output file.NullPointerException - if file is null.save(File)JsonCache.Root flushOnShutdown(OutputStream out)
out - The output stream, which is closed after writing it on shutdown.NullPointerException - if out is null.save(OutputStream)com.fasterxml.jackson.databind.ObjectMapper getMapper()
mapper(ObjectMapper)JsonCache.Root.MergePolicy getMergePolicy()
load() is called on a cache that is already loaded.
The default is JsonCache.Root.MergePolicy.MERGE_RECURSIVE;mergePolicy(MergePolicy)boolean isDirty()
true if there are unsaved changes.JsonCache.Root load(File file) throws JsonCache.CacheException
merge policy. The call has no effect if the file does not
exist.file - The JSON file to load.JsonCache.CacheException - if the file exists but could not be read or its content is not valid JSON.NullPointerException - if file is null.save(File),
save(OutputStream),
unload()JsonCache.Root load(InputStream in) throws JsonCache.CacheException
merge policy.in - The input stream from which to load, which is closed before the method returns.JsonCache.CacheException - if the stream content is not valid JSON.NullPointerException - if in is null.save(File),
save(OutputStream),
unload()JsonCache.Root mapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
mapper - The new mapper.NullPointerException - if mapper is null.getMapper()JsonCache.Root mergePolicy(JsonCache.Root.MergePolicy policy)
load() is called for a cache that is already loaded.policy - The merge policy.NullPointerException - if policy is null.getMergePolicy()JsonCache.Root save(File file) throws JsonCache.CacheException
file - The output file.NullPointerException - if file is null.JsonCache.CacheException - if the root node does not exist or if unable to create or write the file.JsonCache.Root save(OutputStream out) throws JsonCache.CacheException
out - The output stream, which is closed before the method returns.NullPointerException - if out is null.JsonCache.CacheException - if the root node does not exist or if unable to create or write the file.JsonCache.Root unload()
null.load(File),
load(InputStream)Copyright © 2019. All rights reserved.