mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
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:
@@ -25,6 +25,7 @@ import net.openhft.chronicle.common.TimeProvider;
|
||||
import net.openhft.chronicle.map.*;
|
||||
import net.openhft.lang.io.serialization.BytesMarshaller;
|
||||
import net.openhft.lang.io.serialization.BytesMarshallerFactory;
|
||||
import net.openhft.lang.io.serialization.ObjectFactory;
|
||||
import net.openhft.lang.io.serialization.ObjectSerializer;
|
||||
import net.openhft.lang.io.serialization.impl.NullObjectFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -52,8 +53,7 @@ public class ChronicleSetBuilder<E>
|
||||
ChronicleSetBuilder(Class<E> keyClass) {
|
||||
chronicleMapBuilder = ChronicleMapBuilder.of(keyClass, DummyValue.class)
|
||||
.entryAndValueAlignment(Alignment.NO_ALIGNMENT)
|
||||
.valueMarshallerAndFactory(DummyValueMarshaller.INSTANCE,
|
||||
NullObjectFactory.<DummyValue>of());
|
||||
.valueMarshaller(DummyValueMarshaller.INSTANCE);
|
||||
}
|
||||
|
||||
public static <K> ChronicleSetBuilder<K> of(Class<K> keyClass) {
|
||||
@@ -244,6 +244,23 @@ public class ChronicleSetBuilder<E>
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>Actually this is just a convenience method supporting key marshaller configurations, made
|
||||
* initially during {@link #of(Class)} call. Because if you {@linkplain
|
||||
* #keyMarshaller(BytesMarshaller) configure} own custom key marshaller, this method doesn't
|
||||
* take any effect on the maps constructed by this builder.
|
||||
*
|
||||
* @see #of(Class)
|
||||
*/
|
||||
@Override
|
||||
public ChronicleSetBuilder<E> keyDeserializationFactory(
|
||||
@NotNull ObjectFactory<E> keyDeserializationFactory) {
|
||||
chronicleMapBuilder.keyDeserializationFactory(keyDeserializationFactory);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChronicleSetBuilder<E> immutableKeys() {
|
||||
chronicleMapBuilder.immutableKeys();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains {@link net.openhft.chronicle.set.ChronicleSet} interface and
|
||||
* {@link net.openhft.chronicle.set.ChronicleSetBuilder} class.
|
||||
*/
|
||||
package net.openhft.chronicle.set;
|
||||
Reference in New Issue
Block a user