Skip to content

Commit b50c7cf

Browse files
authored
Update collector-context.md (#430)
* Update collector-context.md More spelling. * Update collector-context.md
1 parent e152f9c commit b50c7cf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/collector-context.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ CollectorContext and Collector classes are designed to work with this use case.
99

1010
#### How to use CollectorContext
1111

12-
Objects of CollectorContext live on ThreadLocal which is unique for every thread. This allows users to add objects to context at many points in the framework like Formats,Validators (Effectively CollectorContext can be used at any touch point in the validateAndCollect method thread call).
12+
Objects of CollectorContext live on ThreadLocal which is unique for every thread. This allows users to add objects to context at many points in the framework like Formats, Validators (Effectively CollectorContext can be used at any touch point in the validateAndCollect method thread call).
1313

14-
CollectorContext instance can be obtained by calling the getInstance static method on CollectorContext.This method gives an instance from the ThreadLocal for the current thread.
14+
CollectorContext instance can be obtained by calling the getInstance static method on CollectorContext. This method gives an instance from the ThreadLocal for the current thread.
1515

16-
Collectors are added to CollectorContext. Collectors allows to collect the objects. A Collector is added to CollectorContext with a name and corresponding Collector instance.
16+
Collectors are added to CollectorContext. Collectors allow to collect the objects. A Collector is added to CollectorContext with a name and corresponding Collector instance.
1717

1818
```
1919
CollectorContext collectorContext = CollectorContext.getInstance();
@@ -27,7 +27,7 @@ collectorContext.add(SAMPLE_COLLECTOR_NAME, new Collector<List<String>>() {
2727
});
2828
```
2929

30-
However there might be usecases where we want to add a simple Object like String,Integer, etc into the Context. This can be done the same way a collector is added to the context.
30+
However there might be use cases where we want to add a simple Object like String, Integer, etc, into the Context. This can be done the same way a collector is added to the context.
3131

3232
```
3333
CollectorContext collectorContext = CollectorContext.getInstance();
@@ -47,7 +47,7 @@ To validate the schema with the ability to use CollectorContext, validateAndColl
4747

4848
Note that CollectorContext will be removed from ThreadLocal once validateAndCollect method returns. Also the data collected by Collectors is loaded into CollectorContext only after all the validations are done.
4949

50-
There might be usecases where a collector needs to collect the data at multiple touch points. For example one usecase might be collecting data in a validator and a formatter.If you are using a Collector rather than a Object, the combine method of the Collector allows to define how we want to combine the data into existing Collector.CollectorContext combineWithCollector method calls the combine method on the Collector. User just needs to call the CollectorContext combineWithCollector method every time some data needs to merged into existing Collector. The collect method on the Collector is called by the framework at the end of validation to return the data that was collected.
50+
There might be usecases where a collector needs to collect the data at multiple touch points. For example one usecase might be collecting data in a validator and a formatter. If you are using a Collector rather than a Object, the combine method of the Collector allows to define how we want to combine the data into existing Collector. CollectorContext combineWithCollector method calls the combine method on the Collector. User just needs to call the CollectorContext combineWithCollector method every time some data needs to merged into existing Collector. The collect method on the Collector is called by the framework at the end of validation to return the data that was collected.
5151

5252
```
5353
class CustomCollector implements Collector<List<String>> {
@@ -79,7 +79,7 @@ collectorContext.combineWithCollector(SAMPLE_COLLECTOR, node.textValue());
7979
8080
```
8181

82-
One important thing to note when using Collectors is if we call get method on CollectorContext before the validation is complete, We would get back a Collector instance that was added to CollectorContext.
82+
One important thing to note when using Collectors is if we call get method on CollectorContext before the validation is complete, we would get back a Collector instance that was added to CollectorContext.
8383

8484
```
8585
// Returns Collector before validation is done.

0 commit comments

Comments
 (0)