Skip to content

Commit b90e4cd

Browse files
authored
Merge pull request #141 from dfa1/master
Minor javadoc fixes
2 parents e5e449e + 01b5102 commit b90e4cd

32 files changed

+85
-90
lines changed

src/main/java/org/dataloader/BatchLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* The back-end service returned results in a different order than we requested, likely because it was more efficient for it to
5555
* do so. Also, it omitted a result for key 6, which we may interpret as no value existing for that key.
5656
* <p>
57-
* To uphold the constraints of the batch function, it must return an List of values the same length as
57+
* To uphold the constraints of the batch function, it must return a List of values the same length as
5858
* the List of keys, and re-order them to ensure each index aligns with the original keys [ 2, 9, 6, 1 ]:
5959
*
6060
* <pre>

src/main/java/org/dataloader/BatchLoaderEnvironment.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Map<Object, Object> getKeyContexts() {
5454
* {@link org.dataloader.DataLoader#loadMany(java.util.List, java.util.List)} can be given
5555
* a context object when it is invoked. A list of them is present by this method.
5656
*
57-
* @return a list of key context objects in the order they where encountered
57+
* @return a list of key context objects in the order they were encountered
5858
*/
5959
public List<Object> getKeyContextsList() {
6060
return keyContextsList;

src/main/java/org/dataloader/CacheMap.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static <K, V> CacheMap<K, V> simpleMap() {
6565
/**
6666
* Gets the specified key from the cache map.
6767
* <p>
68-
* May throw an exception if the key does not exists, depending on the cache map implementation that is used,
68+
* May throw an exception if the key does not exist, depending on the cache map implementation that is used,
6969
* so be sure to check {@link CacheMap#containsKey(Object)} first.
7070
*
7171
* @param key the key to retrieve

src/main/java/org/dataloader/DataLoader.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoader<K, V> batchLoadF
108108
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
109109
* {@link org.dataloader.Try} objects.
110110
* <p>
111-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
111+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
112112
* you can use this form to create the data loader.
113113
* <p>
114114
* Using Try objects allows you to capture a value returned or an exception that might
@@ -186,7 +186,7 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoaderWithContext<K, V>
186186
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
187187
* {@link org.dataloader.Try} objects.
188188
* <p>
189-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
189+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
190190
* you can use this form to create the data loader.
191191
* <p>
192192
* Using Try objects allows you to capture a value returned or an exception that might
@@ -264,7 +264,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoader<K, V
264264
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
265265
* {@link org.dataloader.Try} objects.
266266
* <p>
267-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
267+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
268268
* you can use this form to create the data loader.
269269
* <p>
270270
* Using Try objects allows you to capture a value returned or an exception that might
@@ -343,7 +343,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithC
343343
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
344344
* {@link org.dataloader.Try} objects.
345345
* <p>
346-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
346+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
347347
* you can use this form to create the data loader.
348348
* <p>
349349
* Using Try objects allows you to capture a value returned or an exception that might
@@ -471,11 +471,11 @@ public CompletableFuture<V> load(K key) {
471471
* This will return an optional promise to a value previously loaded via a {@link #load(Object)} call or empty if not call has been made for that key.
472472
* <p>
473473
* If you do get a present CompletableFuture it does not mean it has been dispatched and completed yet. It just means
474-
* its at least pending and in cache.
474+
* it's at least pending and in cache.
475475
* <p>
476476
* If caching is disabled there will never be a present Optional returned.
477477
* <p>
478-
* NOTE : This will NOT cause a data load to happen. You must called {@link #load(Object)} for that to happen.
478+
* NOTE : This will NOT cause a data load to happen. You must call {@link #load(Object)} for that to happen.
479479
*
480480
* @param key the key to check
481481
*
@@ -494,7 +494,7 @@ public Optional<CompletableFuture<V>> getIfPresent(K key) {
494494
* <p>
495495
* If caching is disabled there will never be a present Optional returned.
496496
* <p>
497-
* NOTE : This will NOT cause a data load to happen. You must called {@link #load(Object)} for that to happen.
497+
* NOTE : This will NOT cause a data load to happen. You must call {@link #load(Object)} for that to happen.
498498
*
499499
* @param key the key to check
500500
*

src/main/java/org/dataloader/DataLoaderFactory.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoader<K, V> batchLoadF
4242
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
4343
* {@link org.dataloader.Try} objects.
4444
* <p>
45-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
45+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
4646
* you can use this form to create the data loader.
4747
* <p>
4848
* Using Try objects allows you to capture a value returned or an exception that might
@@ -109,7 +109,7 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoaderWithContext<K, V>
109109
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
110110
* {@link org.dataloader.Try} objects.
111111
* <p>
112-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
112+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
113113
* you can use this form to create the data loader.
114114
* <p>
115115
* Using Try objects allows you to capture a value returned or an exception that might
@@ -176,7 +176,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoader<K, V
176176
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
177177
* {@link org.dataloader.Try} objects.
178178
* <p>
179-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
179+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
180180
* you can use this form to create the data loader.
181181
* <p>
182182
* Using Try objects allows you to capture a value returned or an exception that might
@@ -244,7 +244,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithC
244244
* (batching, caching and unlimited batch size) where the batch loader function returns a list of
245245
* {@link org.dataloader.Try} objects.
246246
* <p>
247-
* If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
247+
* If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
248248
* you can use this form to create the data loader.
249249
* <p>
250250
* Using Try objects allows you to capture a value returned or an exception that might

src/main/java/org/dataloader/DataLoaderHelper.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
import static org.dataloader.impl.Assertions.nonNull;
3535

3636
/**
37-
* This helps break up the large DataLoader class functionality and it contains the logic to dispatch the
38-
* promises on behalf of its peer dataloader
37+
* This helps break up the large DataLoader class functionality, and it contains the logic to dispatch the
38+
* promises on behalf of its peer dataloader.
3939
*
4040
* @param <K> the type of keys
4141
* @param <V> the type of values
@@ -148,13 +148,11 @@ CompletableFuture<V> load(K key, Object loadContext) {
148148
}
149149
}
150150

151-
@SuppressWarnings("unchecked")
152151
Object getCacheKey(K key) {
153152
return loaderOptions.cacheKeyFunction().isPresent() ?
154153
loaderOptions.cacheKeyFunction().get().getKey(key) : key;
155154
}
156155

157-
@SuppressWarnings("unchecked")
158156
Object getCacheKeyWithContext(K key, Object context) {
159157
return loaderOptions.cacheKeyFunction().isPresent() ?
160158
loaderOptions.cacheKeyFunction().get().getKeyWithContext(key, context) : key;
@@ -296,9 +294,9 @@ private void possiblyClearCacheEntriesOnExceptions(List<K> keys) {
296294
if (keys.isEmpty()) {
297295
return;
298296
}
299-
// by default we don't clear the cached view of this entry to avoid
300-
// frequently loading the same error. This works for short lived request caches
301-
// but might work against long lived caches. Hence we have an option that allows
297+
// by default, we don't clear the cached view of this entry to avoid
298+
// frequently loading the same error. This works for short-lived request caches
299+
// but might work against long-lived caches. Hence, we have an option that allows
302300
// it to be cleared
303301
if (!loaderOptions.cachingExceptionsEnabled()) {
304302
keys.forEach(dataLoader::clear);
@@ -384,7 +382,7 @@ CompletableFuture<List<V>> invokeLoader(List<K> keys, List<Object> keyContexts,
384382
return completedFuture(assembledValues);
385383
} else {
386384
//
387-
// we missed some of the keys from cache, so send them to the batch loader
385+
// we missed some keys from cache, so send them to the batch loader
388386
// and then fill in their values
389387
//
390388
CompletableFuture<List<V>> batchLoad = invokeLoader(missedKeys, missedKeyContexts);

src/main/java/org/dataloader/DataLoaderOptions.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public DataLoaderOptions setCachingEnabled(boolean cachingEnabled) {
135135
/**
136136
* Option that determines whether to cache exceptional values (the default), or not.
137137
*
138-
* For short lived caches (that is request caches) it makes sense to cache exceptions since
139-
* its likely the key is still poisoned. However if you have long lived caches, then it may make
138+
* For short-lived caches (that is request caches) it makes sense to cache exceptions since
139+
* it's likely the key is still poisoned. However, if you have long-lived caches, then it may make
140140
* sense to set this to false since the downstream system may have recovered from its failure
141141
* mode.
142142
*
@@ -147,7 +147,7 @@ public boolean cachingExceptionsEnabled() {
147147
}
148148

149149
/**
150-
* Sets the option that determines whether exceptional values are cachedis enabled.
150+
* Sets the option that determines whether exceptional values are cache enabled.
151151
*
152152
* @param cachingExceptionsEnabled {@code true} to enable caching exceptional values, {@code false} otherwise
153153
*
@@ -236,7 +236,7 @@ public StatisticsCollector getStatisticsCollector() {
236236

237237
/**
238238
* Sets the statistics collector supplier that will be used with these data loader options. Since it uses
239-
* the supplier pattern, you can create a new statistics collector on each call or you can reuse
239+
* the supplier pattern, you can create a new statistics collector on each call, or you can reuse
240240
* a common value
241241
*
242242
* @param statisticsCollector the statistics collector to use

src/main/java/org/dataloader/DataLoaderRegistry.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public Set<String> getKeys() {
127127
}
128128

129129
/**
130-
* This will called {@link org.dataloader.DataLoader#dispatch()} on each of the registered
130+
* This will be called {@link org.dataloader.DataLoader#dispatch()} on each of the registered
131131
* {@link org.dataloader.DataLoader}s
132132
*/
133133
public void dispatchAll() {
@@ -197,7 +197,7 @@ public Builder register(String key, DataLoader<?, ?> dataLoader) {
197197
}
198198

199199
/**
200-
* This will combine together the data loaders in this builder with the ones
200+
* This will combine the data loaders in this builder with the ones
201201
* from a previous {@link DataLoaderRegistry}
202202
*
203203
* @param otherRegistry the previous {@link DataLoaderRegistry}

src/main/java/org/dataloader/MappedBatchLoader.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616

1717
package org.dataloader;
1818

19-
import java.util.List;
2019
import java.util.Map;
2120
import java.util.Set;
2221
import java.util.concurrent.CompletionStage;
2322

2423
/**
25-
* A function that is invoked for batch loading a map of of data values indicated by the provided set of keys. The
24+
* A function that is invoked for batch loading a map of data values indicated by the provided set of keys. The
2625
* function returns a promise of a map of results of individual load requests.
2726
* <p>
2827
* There are a few constraints that must be upheld:

src/main/java/org/dataloader/MappedBatchLoaderWithContext.java

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.dataloader;
1818

19-
import java.util.List;
2019
import java.util.Map;
2120
import java.util.Set;
2221
import java.util.concurrent.CompletionStage;

src/main/java/org/dataloader/Try.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* Try is class that allows you to hold the result of computation or the throwable it produced.
1717
*
18-
* This class is useful in {@link org.dataloader.BatchLoader}s so you can mix a batch of calls where some of
18+
* This class is useful in {@link org.dataloader.BatchLoader}s so you can mix a batch of calls where some
1919
* the calls succeeded and some of them failed. You would make your batch loader declaration like :
2020
*
2121
* <pre>
@@ -89,8 +89,8 @@ public static <V> Try<V> failed(Throwable throwable) {
8989
}
9090

9191
/**
92-
* This returns a Try that has always failed with an consistent exception. Use this when
93-
* yiu dont care about the exception but only that the Try failed.
92+
* This returns a Try that has always failed with a consistent exception. Use this when
93+
* you don't care about the exception but only that the Try failed.
9494
*
9595
* @param <V> the type of value
9696
*

src/main/java/org/dataloader/ValueCache.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
* <p>
1616
* It differs from {@link CacheMap} which is in fact a cache of promised values aka {@link CompletableFuture}&lt;V&gt;'s.
1717
* <p>
18-
* {@link ValueCache} is more suited to be a wrapper of a long-lived or externallly cached values. {@link CompletableFuture}s cant
18+
* {@link ValueCache} is more suited to be a wrapper of a long-lived or externally cached values. {@link CompletableFuture}s can't
1919
* be easily placed in an external cache outside the JVM say, hence the need for the {@link ValueCache}.
2020
* <p>
2121
* {@link DataLoader}s use a two stage cache strategy if caching is enabled. If the {@link CacheMap} already has the promise to a value
22-
* that is used. If not then the {@link ValueCache} is asked for a value, if it has one then that is returned (and cached as a promise in the {@link CacheMap}.
22+
* that is used. If not then the {@link ValueCache} is asked for a value, if it has one then that is returned (and cached as a promise in the {@link CacheMap}).
2323
* <p>
2424
* If there is no value then the key is queued and loaded via the {@link BatchLoader} calls. The returned values will then be stored in
2525
* the {@link ValueCache} and the promises to those values are also stored in the {@link CacheMap}.
@@ -29,7 +29,7 @@
2929
* out of the box.
3030
* <p>
3131
* The API signature uses {@link CompletableFuture}s because the backing implementation MAY be a remote external cache
32-
* and hence exceptions may happen in retrieving values and they may take time to complete.
32+
* and hence exceptions may happen in retrieving values, and they may take time to complete.
3333
*
3434
* @param <K> the type of cache keys
3535
* @param <V> the type of cache values
@@ -67,8 +67,8 @@ static <K, V> ValueCache<K, V> defaultValueCache() {
6767
CompletableFuture<V> get(K key);
6868

6969
/**
70-
* Gets the specified keys from the value cache, in a batch call. If your underlying cache cant do batch caching retrieval
71-
* then do not implement this method and it will delegate back to {@link #get(Object)} for you
70+
* Gets the specified keys from the value cache, in a batch call. If your underlying cache cannot do batch caching retrieval
71+
* then do not implement this method, and it will delegate back to {@link #get(Object)} for you
7272
* <p>
7373
* Each item in the returned list of values is a {@link Try}. If the key could not be found then a failed Try just be returned otherwise
7474
* a successful Try contain the cached value is returned.
@@ -104,8 +104,8 @@ default CompletableFuture<List<Try<V>>> getValues(List<K> keys) throws ValueCach
104104
CompletableFuture<V> set(K key, V value);
105105

106106
/**
107-
* Stores the value with the specified keys, or updates it if the keys if they already exist. If your underlying cache cant do batch caching setting
108-
* then do not implement this method and it will delegate back to {@link #set(Object, Object)} for you
107+
* Stores the value with the specified keys, or updates it if the keys if they already exist. If your underlying cache can't do batch caching setting
108+
* then do not implement this method, and it will delegate back to {@link #set(Object, Object)} for you
109109
*
110110
* @param keys the keys to store
111111
* @param values the values to store

src/main/java/org/dataloader/ValueCacheOptions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static ValueCacheOptions newOptions() {
2222

2323
/**
2424
* This controls whether the {@link DataLoader} will wait for the {@link ValueCache#set(Object, Object)} call
25-
* to complete before it completes the returned value. By default this is false and hence
25+
* to complete before it completes the returned value. By default, this is false and hence
2626
* the {@link ValueCache#set(Object, Object)} call may complete some time AFTER the data loader
2727
* value has been returned.
2828
*

src/main/java/org/dataloader/annotations/ExperimentalApi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* This represents code that the graphql-java project considers experimental API and while our intention is that it will
1515
* progress to be {@link PublicApi}, its existence, signature of behavior may change between releases.
1616
*
17-
* In general unnecessary changes will be avoided but you should not depend on experimental classes being stable
17+
* In general unnecessary changes will be avoided, but you should not depend on experimental classes being stable
1818
*/
1919
@Retention(RetentionPolicy.RUNTIME)
2020
@Target(value = {CONSTRUCTOR, METHOD, TYPE, FIELD})

src/main/java/org/dataloader/annotations/Internal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* This represents code that the java-dataloader project considers internal code that MAY not be stable within
1414
* major releases.
1515
*
16-
* In general unnecessary changes will be avoided but you should not depend on internal classes being stable
16+
* In general unnecessary changes will be avoided, but you should not depend on internal classes being stable
1717
*/
1818
@Retention(RetentionPolicy.RUNTIME)
1919
@Target(value = {CONSTRUCTOR, METHOD, TYPE, FIELD})

src/main/java/org/dataloader/annotations/PublicSpi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* The guarantee is for callers of code with this annotation as well as derivations that inherit / implement this code.
1717
*
18-
* New methods will not be added (without using default methods say) that would nominally breaks SPI implementations
18+
* New methods will not be added (without using default methods say) that would nominally break SPI implementations
1919
* within a major release.
2020
*/
2121
@Retention(RetentionPolicy.RUNTIME)

src/main/java/org/dataloader/annotations/VisibleForTesting.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import static java.lang.annotation.ElementType.METHOD;
1010

1111
/**
12-
* Marks fields, methods etc as more visible than actually needed for testing purposes.
12+
* Marks fields, methods etc. as more visible than actually needed for testing purposes.
1313
*/
1414
@Retention(RetentionPolicy.RUNTIME)
1515
@Target(value = {CONSTRUCTOR, METHOD, FIELD})

0 commit comments

Comments
 (0)