From a09cf94b3504f07bc4fe9bb41f345b29073e3905 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Mon, 1 Dec 2014 12:26:19 +0000 Subject: [PATCH] imporved javadoc --- .../chronicle/map/MapEventListener.java | 58 ++++++++++--------- .../OnHeapUpdatableChronicleMapBuilder.java | 6 +- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/MapEventListener.java b/src/main/java/net/openhft/chronicle/map/MapEventListener.java index 72b8e2679..5cf73f8b9 100644 --- a/src/main/java/net/openhft/chronicle/map/MapEventListener.java +++ b/src/main/java/net/openhft/chronicle/map/MapEventListener.java @@ -26,22 +26,22 @@ import org.slf4j.LoggerFactory; import java.io.Serializable; /** - * Contains methods which are called when {@link ChronicleMap} key events occur. Typical use cases: + * Contains methods which are called when {@link ChronicleMap} key events occur. Typical use cases: + * * - *

This is an adapter class - all methods have default implementations as no-ops. Extend this class and - * override only methods corresponding the events you are interested in. + *

This is an adapter class - all methods have default implementations as no-ops. Extend this + * class and override only methods corresponding the events you are interested in. * *

To configure {@code MapEventListener} for {@code ChronicleMap}, use {@link * AbstractChronicleMapBuilder#eventListener(MapEventListener)} method. * *

See {@link #logging(String)} implementation. * - *

All these calls are synchronous while a {@code ChronicleMap} lock is held so make them as quick as - * possible. + *

All these calls are synchronous while a {@code ChronicleMap} lock is held so make them as + * quick as possible. * - *

The {@code entry} passed to the methods is {@code Bytes} instance positioned at meta data area. See - * {@link ChronicleHashBuilder#metaDataBytes(int)} for more information. + *

The {@code entry} passed to the methods is {@code Bytes} instance positioned at meta data + * area. See {@link ChronicleHashBuilder#metaDataBytes(int)} for more information. * * @param key type of the maps, trackable by this event listener * @param value type of the maps, trackable by this event listener @@ -51,15 +51,17 @@ public abstract class MapEventListener implements Serializable { private static final long serialVersionUID = 0L; /** - * Returns the map event listener, which logs strings like - * "{@linkplain ChronicleMap#file() map file} opType key value", where opType is either "get", - * "put" or "remove", to the logger provided by SLF4J. + * Returns the map event listener, which logs strings like "{@linkplain ChronicleMap#file() map + * file} opType key value", where opType is either "get", "put" or "remove", to the logger + * provided by SLF4J. * - * @param the map key type - * @param the map value type + * @param the map key type + * @param the map value type + * @param prefix logging prefix * @return the logging event listener */ public static MapEventListener logging(String prefix) { + //noinspection unchecked return new LoggingMapEventListener(prefix); } @@ -90,40 +92,42 @@ public abstract class MapEventListener implements Serializable { } /** - * This method is called if the key is found in the map during {@link ChronicleMap#get get}, {@link - * ChronicleMap#getUsing getUsing} or {@link ChronicleMap#acquireUsing acquireUsing} method call. + * This method is called if the key is found in the map during {@link ChronicleMap#get get}, + * {@link ChronicleMap#getUsing getUsing} or {@link ChronicleMap#acquireUsing acquireUsing} + * method call. * - * @param key the key looked up - * @param foundValue the value found for the key + * @param key the key looked up + * @param foundValue the value found for the key */ public void onGetFound(K key, V foundValue) { // do nothing } /** - * This method is called whenever a new value is put for the key in the map during calls of such methods - * as {@link ChronicleMap#put put}, {@link ChronicleMap#putIfAbsent putIfAbsent}, {@link + * This method is called whenever a new value is put for the key in the map during calls of such + * methods as {@link ChronicleMap#put put}, {@link ChronicleMap#putIfAbsent putIfAbsent}, {@link * ChronicleMap#replace(Object, Object, Object) replace}, etc. When a new value is {@linkplain - * AbstractChronicleMapBuilder#defaultValue(Object) default} for the map or obtained during {@link - * ChronicleMap#acquireUsing acquireUsing} call is put for the key, this method is called as well. + * AbstractChronicleMapBuilder#defaultValue(Object) default} for the map or obtained during + * {@link ChronicleMap#acquireUsing acquireUsing} call is put for the key, this method is called + * as well. * *

This method is called when put is already happened. * * @param key the key the given value is put for * @param newValue the value which is now associated with the given key - * @param replacedValue the value which was replaced by {@code newValue}, {@code null} - * if the key was absent in the map before current {@code ChronicleMap} + * @param replacedValue the value which was replaced by {@code newValue}, {@code null} if the + * key was absent in the map before current {@code ChronicleMap} */ public void onPut(K key, V newValue, @Nullable V replacedValue) { // do nothing } /** - * This is called when an entry is removed. Misses, i. e. when {@code map.remove(key)} - * is called, but key is already absent in the map, are not notified. + * This is called when an entry is removed. Misses, i. e. when {@code map.remove(key)} is + * called, but key is already absent in the map, are not notified. * - * @param key the key removed from the map - * @param value the value which was associated with the given key + * @param key the key removed from the map + * @param value the value which was associated with the given key */ public void onRemove(K key, V value) { // do nothing diff --git a/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java index 5b7be09d9..eaed43fdf 100644 --- a/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java @@ -36,7 +36,7 @@ import java.io.Serializable; * non-{@link Byteable} values, which don't point to off-heap memory directly, including primitives ({@link * Long}, {@link Double}, etc.), {@link String}s and {@link CharSequence}s, values implementing {@link * BytesMarshallable}, {@link Externalizable} or {@link Serializable} interface, or any other values for which - * {@linkplain #valueMarshaller(BytesMarshaller) custom marshaller} is provided.

Use static {@link + * {@linkplain #valueMarshaller(BytesMarshaller) custom marshaller} is provided. Use static {@link * #of(Class, Class) of(Key.class, Value.class)} method to obtain a {@code ChronicleMapOnHeapUpdatableBuilder} * instance. * @@ -149,7 +149,7 @@ final class OnHeapUpdatableChronicleMapBuilder * // this class hasn't implemented yet, just for example * .objectSerializer(new KryoObjectSerializer()) * .create();} - *

This serializer is used to serialize both keys and values, if they both require this: loosely + *

This serializer is used to serialize both keys and values, if they both require this: loosely * typed, nullable, and custom {@linkplain #keyMarshaller(BytesMarshaller) key} and {@linkplain * #valueMarshaller(BytesMarshaller) value} marshallers are not configured. */ @@ -160,7 +160,7 @@ final class OnHeapUpdatableChronicleMapBuilder } /** - * {@inheritDoc}

If {@linkplain #valueMarshaller(BytesMarshaller) custom value marshaller} is + * {@inheritDoc} If {@linkplain #valueMarshaller(BytesMarshaller) custom value marshaller} is * configured, this configuration is unused, because it is incapsulated in {@link * BytesMarshaller#read(Bytes)} method (without provided instance to read the data into), i. e. it's is * the user-side responsibility. Actually this is just a convenience method supporting value marshaller