@@ -10,7 +10,7 @@ Helper class logger of progress operation.
10
10
It is intended for easy add possibility of logging progress of operations.
11
11
1 . For example in Groovy way it so simple as:
12
12
13
- ```
13
+ ``` groovy
14
14
ProgressLogger.each([1, 2, 3, 4, 5]){
15
15
println it // Some long run operation
16
16
}
@@ -32,14 +32,14 @@ It will produce (by println) output like:
32
32
2 . Ofter useful provide out method, for example to tie into current scope logger instead of global stdout, and add
33
33
some additional transform, it also simple:
34
34
35
- ```
35
+ ``` groovy
36
36
ProgressLogger.each([1, 2, 3, 4, 5]){
37
37
println it
38
38
}{ log.info "=$it=" }
39
39
```
40
40
41
41
3 . It may be used directly in plain old Java style like:
42
- ```
42
+ ``` groovy
43
43
ProgressLogger pl = new ProgressLogger(aisList, {log.info(it)});
44
44
for (Object aisObj in aisList){
45
45
pl.next();
@@ -52,12 +52,12 @@ for (Object aisObj in aisList){
52
52
}
53
53
```
54
54
5 . Or measure one run:
55
- ```
55
+ ``` groovy
56
56
ProgressLogger.measure({log.info(it)}, { /* long work * / }, 'Doing cool work')
57
57
```
58
58
6 . When amount of elements or iterations is not known (f.e. stream processing or recursive calls like tree traversal)
59
59
totalAmountOfElements set to -1 and simpler statistic returned:
60
- ```
60
+ ``` groovy
61
61
def pl = new ProgressLogger()
62
62
[1, 2, 3, 4].each{
63
63
sleep 1000;
@@ -79,22 +79,22 @@ Result will be something like:
79
79
Main goal to add functionality to ` ConfigObject ` GDK class.
80
80
81
81
First it allow operations opposite flatten, set hierarchy from string, like:
82
- ```
82
+ ``` groovy
83
83
ConfigExtended conf = …
84
84
conf.setFromPropertyPathLikeKey('some.deep.hierarchy.of.properties', value)
85
85
```
86
86
and then access it as usual:
87
- ```
87
+ ``` groovy
88
88
conf.some.deep.hierarchy.of.properties
89
89
```
90
90
not as it is one string property.
91
- ```
91
+ ``` groovy
92
92
conf.'some.deep.hierarchy.of.properties'
93
93
```
94
94
95
95
Additionally it override merge of ` ConfigObjects ` and do not replace completely replace Objects but set properties of it.
96
96
For example standard behaviour:
97
- ```
97
+ ``` groovy
98
98
// Uncomment next line if you are plan run example from GroovyConsole to handle defined there classes: http://groovy.329449.n5.nabble.com/GroovyConsole-and-context-thread-loader-td4471707.html
99
99
// Thread.currentThread().contextClassLoader = getClass().classLoader
100
100
@groovy.transform.ToString
@@ -115,4 +115,4 @@ assert config.test == 's change'
115
115
```
116
116
117
117
But stop, why config.test replaced? Our intention was to set only their field s!
118
- ** That class do that magic**
118
+ ** That class do that magic**
0 commit comments