@ParametersAreNonnullByDefault public abstract class AbstractInMemoryBackend extends AbstractBackend implements InMemoryBackend, ManyValueWithLists, AllReferenceAs<Long>
InMemoryBackend that provides the default behavior of containers and meta-classes management.| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractInMemoryBackend.Sizes
Some statistics about the size of key and values.
|
| Modifier and Type | Field and Description |
|---|---|
protected static BeanSerializerFactory |
SERIALIZER_FACTORY
The
BeanSerializerFactory to use for creating the BinarySerializer instances. |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractInMemoryBackend()
Constructs a new
AbstractInMemoryBackend. |
protected |
AbstractInMemoryBackend(String name)
Constructs a new
AbstractInMemoryBackend with the given name. |
| Modifier and Type | Method and Description |
|---|---|
Stream<Id> |
allInstancesOf(Set<ClassBean> metaClasses)
Retrieves all instances of the given
metaClasses. |
protected void |
checkFeature(FeatureBean feature)
Checks the specified
feature before using it. |
void |
containerFor(Id id,
SingleFeatureBean container)
Stores the
container for the specified id. |
Optional<SingleFeatureBean> |
containerOf(Id id)
Retrieves the container for the specified
id. |
protected abstract Map<Id,SingleFeatureBean> |
containers()
Returns the map that holds all containers.
|
protected abstract Map<SingleFeatureBean,Object> |
features()
Returns the map that holds single-features.
|
protected abstract Map<Id,ClassBean> |
instances()
Returns the map that holds all instances.
|
void |
internalSave()
Saves all modifications made on this back-end since the last call.
|
boolean |
metaClassFor(Id id,
ClassBean metaClass)
Stores the
metaClass for the specified id. |
Optional<ClassBean> |
metaClassOf(Id id)
Retrieves the meta-class for the specified
id. |
Converter<Id,Long> |
referenceConverter()
Returns the converter used to transform a reference to the desired type.
|
void |
removeContainer(Id id)
Removes the container of the specified
id. |
void |
removeValue(SingleFeatureBean feature)
Removes the value of the specified
feature. |
<V> Optional<V> |
valueFor(SingleFeatureBean feature,
V value)
Defines the
value of the specified feature. |
<V> Optional<V> |
valueOf(SingleFeatureBean feature)
Retrieves the value of the specified
feature. |
allInstancesOf, close, copyTo, internalClose, internalCopyTo, save, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisDistributed, isPersistentallInstancesOfaddAllValues, addValue, allValuesOf, appendAllValues, appendValue, removeAllValues, removeValue, sizeOfValue, valueFor, valueOfaddAllReferences, addReference, allReferencesOf, appendAllReferences, appendReference, referenceFor, referenceOf, removeAllReferences, removeReference, sizeOfReferencereferenceFor, referenceOf, removeReferenceaddAllValues, addValue, allValuesOf, getOrCreateList, removeAllValues, removeValue, sizeOfValue, valueFor, valueOfmanyReferenceConverterreferenceFor, referenceOf, removeReferenceaddAllReferences, addReference, allReferencesOf, appendAllReferences, appendReference, referenceFor, referenceOf, removeAllReferences, removeReference, sizeOfReference@Nonnull protected static final BeanSerializerFactory SERIALIZER_FACTORY
BeanSerializerFactory to use for creating the BinarySerializer instances.protected AbstractInMemoryBackend()
AbstractInMemoryBackend.public void internalSave()
AbstractBackendinternalSave in class AbstractBackend@Nonnull protected abstract Map<Id,SingleFeatureBean> containers()
@Nonnull protected abstract Map<Id,ClassBean> instances()
@Nonnull protected abstract Map<SingleFeatureBean,Object> features()
protected void checkFeature(FeatureBean feature)
feature before using it.feature - the feature to check@Nonnull public Optional<SingleFeatureBean> containerOf(Id id)
ContainerMapperid.containerOf in interface ContainerMapperid - the Id of the contained elementOptional containing the container, or Optional.empty() if the id has no
defined container.public void containerFor(Id id, SingleFeatureBean container)
ContainerMappercontainer for the specified id.containerFor in interface ContainerMapperid - the Id of the contained elementcontainer - the containing element's container information to storepublic void removeContainer(Id id)
ContainerMapperid.
The container must be completely removed, so that a call to ContainerMapper.containerOf(Id) returns Optional.empty().
removeContainer in interface ContainerMapperid - the Id of the contained element@Nonnull public Optional<ClassBean> metaClassOf(Id id)
ClassMapperid.metaClassOf in interface ClassMapperid - the Id of the elementOptional containing the meta-class, or Optional.empty() if the id has no
defined meta-class.public boolean metaClassFor(Id id, ClassBean metaClass)
ClassMappermetaClass for the specified id.metaClassFor in interface ClassMapperid - the Id of the elementmetaClass - the containing element's meta-class information to storetrue if the meta-class has been defined, false if the id already has a meta-class@Nonnull public Stream<Id> allInstancesOf(Set<ClassBean> metaClasses)
ClassMappermetaClasses.allInstancesOf in interface ClassMappermetaClasses - the meta-classes to compute the instances ofStream containing the instances of the metaClasses@Nonnull public <V> Optional<V> valueOf(SingleFeatureBean feature)
ValueMapperfeature.valueOf in interface ValueMapperV - the type of valuefeature - the bean identifying the valueOptional containing the value, or Optional.empty() if the feature hasn't any value or
doesn't exist@Nonnull public <V> Optional<V> valueFor(SingleFeatureBean feature, V value)
ValueMappervalue of the specified feature.valueFor in interface ValueMapperV - the type of valuefeature - the bean identifying the valuevalue - the value to setOptional containing the previous value of the feature, or Optional.empty() if
the feature has no value beforepublic void removeValue(SingleFeatureBean feature)
ValueMapperfeature.removeValue in interface ValueMapperfeature - the bean identifying the value@Nonnull public Converter<Id,Long> referenceConverter()
ReferenceAsreferenceConverter in interface ReferenceAs<Long>Copyright © 2013–2019 Atlanmod. All rights reserved.