HCOLL-136 HCOLL-137 HCOLL-153 HCOLL-160

1. Separated ChronicleMapBuilder (for non-Byteable values) and
OffHeapUpdatableChronicleMapBuilder (for Byteable values) with common base
AbstractChronicleMapBuilder (public just to inherit common javadocs)

2. Added ChronicleHashBuilder.keyDeserializationFactory() and
AbstractChronicleMapBuilder.valueDeserializationFactory() (former
ChronicleMapBuilder.valueFactory() method)

3. Changed ChronicleMap.get(), getUsing() API and impl to what was
initially intended - now they ALWAYS returns null, if key is absent

4. acquireUsing() API, common for the cases with Byteable and non-Byteable
values: puts defaultValue or defaultValueProvider.get(key), if the key is
absent, then acquireUsing() behaves just like getUsing()

5. For off0heap updatable ChronicleMaps (Byteable values), added
prepareValueBytes() configuration which formalizes zeroing out value bytes

6. Javadoc fixes and improvements
This commit is contained in:
leventov
2014-10-27 20:15:26 +03:00
parent b374a9bd50
commit 0c45ee8aff
30 changed files with 1529 additions and 1084 deletions
@@ -22,26 +22,19 @@ import java.io.Serializable;
/**
* Default value computation strategy, used
* in {@link ChronicleMapBuilder#defaultValueProvider(DefaultValueProvider)} configuration.
* in {@link AbstractChronicleMapBuilder#defaultValueProvider(DefaultValueProvider)} configuration.
*
* @param <K> map key class
* @param <V> map value class
*/
public interface DefaultValueProvider<K, V> extends Serializable {
/**
* Returns a value to be put and returned from {@link ChronicleMap#get(Object)} get()} or
* {@link ChronicleMap#getUsing(Object, Object)} call for the specified key, if it is absent
* in the map.
*
* <p>If this method returns {@code null}, it isn't put for the key in the map.
* Returns a value to be put during {@link ChronicleMap#acquireUsing(Object, Object)} call
* for the specified key, if it is absent in the map.
*
* @param key key absent in the map
* @param usingValue an object provided as second parameter of current
* {@link ChronicleMap#getUsing(Object, Object)} call, or {@code null}, if this method is called
* within {@code get()} call. This object might be optionally initialized and returned back
* from this method.
* @return value to be put for the specified key in the map, or {@code null}, if the key should
* remain absent in the map
*/
V get(K key, V usingValue);
V get(K key);
}