Improve documentation

This commit is contained in:
leventov
2016-03-23 20:09:43 +07:00
parent ca5a988873
commit 739796b90d
24 changed files with 509 additions and 80 deletions
@@ -28,7 +28,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentMap;
/**
* Extension of {@link ConcurrentMap} interface, stores the data off-heap.
* {@code ChronicleMap} provides concurrent access to a <i>Chronicle Map key-value store</i> from a
* JVM process.
*
* <p>For information on <ul> <li>how to construct a {@code ChronicleMap}</li> <li>{@code
* ChronicleMap} flavors and properties</li> <li>available configurations</li> </ul> see {@link
@@ -1777,7 +1777,7 @@ public final class ChronicleMapBuilder<K, V> implements
/**
* Inject your SPI code around basic {@code ChronicleMap}'s operations with entries:
* removing entries, replacing the entries' value and inserting the new entry.
* removing entries, replacing entries' value and inserting new entries.
*
* <p>This affects behaviour of ordinary map.put(), map.remove(), etc. calls, as well as removes
* and replacing values <i>during iterations</i>, <i>remote map calls</i> and
@@ -108,7 +108,9 @@ public interface MapEntryOperations<K, V, R> {
* @implNote default implementation calls {@link MapEntry#doRemove()} on the given entry
* and returns {@code null}.
*
* @param entry the entry to remove
* @param entry the entry to remove
* @return result of operation, understandable by higher-level SPIs, e. g. custom
* {@link MapMethods} implementation
* @throws IllegalStateException if some locking/state conditions required to perform remove
* operation are not met
* @throws RuntimeException if removal was unconditionally unsuccessful due to any reason
@@ -125,6 +127,8 @@ public interface MapEntryOperations<K, V, R> {
* entry.doReplaceValue(newValue)} and returns {@code null}.
*
* @param entry the entry to replace the value in
* @return result of operation, understandable by higher-level SPIs, e. g. custom
* {@link MapMethods} implementation
* @throws IllegalStateException if some locking/state conditions required to perform replace
* operation are not met
* @throws RuntimeException if value replacement was unconditionally unsuccessful due
@@ -142,6 +146,8 @@ public interface MapEntryOperations<K, V, R> {
* @implNote default implementation calls {@link MapAbsentEntry#doInsert(Data)
* absentEntry.doInsert(value)} and returns {@code null}.
*
* @return result of operation, understandable by higher-level SPIs, e. g. custom
* {@link MapMethods} implementation
* @throws IllegalStateException if some locking/state conditions required to perform insertion
* operation are not met
* @throws RuntimeException if insertion was unconditionally unsuccessful due to any reason
@@ -32,6 +32,13 @@ import static net.openhft.chronicle.map.MapMethodsSupport.tryReturnCurrentValueI
*/
public interface MapMethods<K, V, R> {
/**
* Backing {@link ChronicleMap#containsKey(Object)} method.
*
* @implNote the default implementation is equivalent to <pre>{@code
* return q.entry() != null;
* }</pre>
*/
default boolean containsKey(MapQueryContext<K, V, R> q) {
return q.entry() != null;
}
@@ -19,6 +19,27 @@ package net.openhft.chronicle.map;
import net.openhft.chronicle.hash.Data;
import org.jetbrains.annotations.NotNull;
/**
* Abstracts returning a value from a query to a {@link ChronicleMap}, used in {@link MapMethods}.
* This interface is not supposed to be implemented in user code.
*
* @param <V> the type of values in the {@code ChronicleMap}
*/
public interface ReturnValue<V> {
/**
* Calling this method on a {@code ReturnValue} object, provided as an argument in a method from
* {@link MapMethods}, designates that the {@code ChronicleMap}'s method (backed by this
* {@code MapMethods}'s method) should return the given {@code value}.
*
* <p>It is not allowed to call {@code returnValue()} twice during a single {@code MapMethods}'s
* method call.
*
* <p>Not calling {@code returnValue()} during {@code MapMethods}'s method call will make the
* backed {@code ChronicleMap}'s method to return {@code null}.
*
* @param value a {@code Data} object wrapping a value, which should be returned from a
* {@code ChronicleMap}'s method, backed by the {@code MapMethods}'s method, to
* which this {@code ReturnValue} instance was passed as an argument
*/
void returnValue(@NotNull Data<V> value);
}
@@ -0,0 +1,21 @@
/*
* Copyright (C) 2015 higherfrequencytrading.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Contains {@link net.openhft.chronicle.map.ChronicleMap} interface, {@code ChronicleMap} context
* interfaces, {@link net.openhft.chronicle.map.ChronicleMapBuilder} class and related stuff.
*/
package net.openhft.chronicle.map;