Skip to content

Commit 008a8ec

Browse files
committed
rename harvest method to extract
1 parent 46a1511 commit 008a8ec

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

compiler/src/main/java/net/jbock/writing/HarvestMethod.java renamed to compiler/src/main/java/net/jbock/writing/ExtractMethod.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
import static net.jbock.writing.CodeBlocks.joinByNewline;
2929

3030
@WritingScope
31-
final class HarvestMethod extends HasCommandRepresentation {
31+
final class ExtractMethod extends HasCommandRepresentation {
3232

3333
private final GeneratedTypes generatedTypes;
3434
private final ParserTypeFactory parserTypeFactory;
3535
private final ParameterSpec left = ParameterSpec.builder(STRING, "left").build();
3636

3737
@Inject
38-
HarvestMethod(
38+
ExtractMethod(
3939
GeneratedTypes generatedTypes,
4040
CommandRepresentation commandRepresentation,
4141
ParserTypeFactory parserTypeFactory) {
@@ -55,7 +55,7 @@ private GeneratedTypes generatedTypes() {
5555
private final Supplier<MethodSpec> harvestMethod = memoize(() -> {
5656
ParameterSpec parser = parserTypeFactory().get().asParam();
5757
CodeBlock constructorArguments = getConstructorArguments();
58-
MethodSpec.Builder spec = MethodSpec.methodBuilder("harvest");
58+
MethodSpec.Builder spec = MethodSpec.methodBuilder("extract");
5959
for (int i = 0; i < namedOptions().size(); i++) {
6060
Mapping<AnnotatedOption> m = namedOptions().get(i);
6161
ParameterSpec p = asParam(m);

compiler/src/main/java/net/jbock/writing/ParseMethod.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ final class ParseMethod extends HasCommandRepresentation {
1818

1919
private final GeneratedTypes generatedTypes;
2020
private final CreateModelMethod createModelMethod;
21-
private final HarvestMethod harvestMethod;
21+
private final ExtractMethod extractMethod;
2222
private final ParserTypeFactory parserTypeFactory;
2323

2424
@Inject
2525
ParseMethod(
2626
GeneratedTypes generatedTypes,
2727
CommandRepresentation commandRepresentation,
2828
CreateModelMethod createModelMethod,
29-
HarvestMethod harvestMethod,
29+
ExtractMethod extractMethod,
3030
ParserTypeFactory parserTypeFactory) {
3131
super(commandRepresentation);
3232
this.generatedTypes = generatedTypes;
3333
this.createModelMethod = createModelMethod;
34-
this.harvestMethod = harvestMethod;
34+
this.extractMethod = extractMethod;
3535
this.parserTypeFactory = parserTypeFactory;
3636
}
3737

@@ -71,8 +71,8 @@ private ParserTypeFactory parserTypeFactory() {
7171
return parserTypeFactory;
7272
}
7373

74-
private HarvestMethod harvestMethod() {
75-
return harvestMethod;
74+
private ExtractMethod harvestMethod() {
75+
return extractMethod;
7676
}
7777

7878
private CreateModelMethod createModelMethod() {

compiler/src/main/java/net/jbock/writing/ParserClass.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public final class ParserClass extends HasCommandRepresentation {
1616
private final ParseOrExitMethod parseOrExitMethod;
1717
private final CreateModelMethod createModelMethod;
1818
private final GeneratedAnnotation generatedAnnotation;
19-
private final HarvestMethod harvestMethod;
19+
private final ExtractMethod extractMethod;
2020
private final OptionNamesMethod optionNamesMethod;
2121
private final OptionStatesMethod optionStatesMethod;
2222

@@ -28,7 +28,7 @@ public final class ParserClass extends HasCommandRepresentation {
2828
ParseOrExitMethod parseOrExitMethod,
2929
CreateModelMethod createModelMethod,
3030
GeneratedAnnotation generatedAnnotation,
31-
HarvestMethod harvestMethod,
31+
ExtractMethod extractMethod,
3232
OptionNamesMethod optionNamesMethod,
3333
OptionStatesMethod optionStatesMethod) {
3434
super(commandRepresentation);
@@ -37,7 +37,7 @@ public final class ParserClass extends HasCommandRepresentation {
3737
this.parseOrExitMethod = parseOrExitMethod;
3838
this.createModelMethod = createModelMethod;
3939
this.generatedAnnotation = generatedAnnotation;
40-
this.harvestMethod = harvestMethod;
40+
this.extractMethod = extractMethod;
4141
this.optionNamesMethod = optionNamesMethod;
4242
this.optionStatesMethod = optionStatesMethod;
4343
}
@@ -53,7 +53,7 @@ public TypeSpec define() {
5353
if (!sourceElement().skipGeneratingParseOrExitMethod()) {
5454
spec.addMethod(parseOrExitMethod.define());
5555
}
56-
spec.addMethod(harvestMethod.get());
56+
spec.addMethod(extractMethod.get());
5757
if (!namedOptions().isEmpty()) {
5858
spec.addField(optionNames().toBuilder()
5959
.initializer("$N()", optionNamesMethod.get()).build());

compiler/src/test/java/net/jbock/processor/BasicFullTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ void testBasicGenerated() {
4949
" RestParser<Void> parser = RestParser.create(Map.of(), Map.of(), 0);",
5050
" try {",
5151
" parser.parse(tokens);",
52-
" return Either.right(harvest(parser));",
52+
" return Either.right(extract(parser));",
5353
" } catch (ExFailure e) {",
5454
" return Either.left(e.toError(createModel()));",
5555
" }",
5656
" }",
5757
"",
58-
" private Arguments harvest(RestParser<Void> parser) throws ExFailure {",
58+
" private Arguments extract(RestParser<Void> parser) throws ExFailure {",
5959
" List<String> _hello = parser.rest()",
6060
" .map(StringConverter.create(Function.identity()))",
6161
" .collect(Eithers.firstFailure())",
@@ -141,13 +141,13 @@ void testPublicParser() {
141141
" RestParser<Void> parser = RestParser.create(Map.of(), Map.of(), 0);",
142142
" try {",
143143
" parser.parse(tokens);",
144-
" return Either.right(harvest(parser));",
144+
" return Either.right(extract(parser));",
145145
" } catch (ExFailure e) {",
146146
" return Either.left(e.toError(createModel()));",
147147
" }",
148148
" }",
149149
"",
150-
" private Arguments harvest(RestParser<Void> parser) throws ExFailure {",
150+
" private Arguments extract(RestParser<Void> parser) throws ExFailure {",
151151
" List<String> _hello = parser.rest()",
152152
" .map(StringConverter.create(Function.identity()))",
153153
" .collect(Eithers.firstFailure())",

compiler/src/test/java/net/jbock/processor/ParseOrExitFullTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void testBasicGenerated() {
5151
" RestParser<Void> parser = RestParser.create(Map.of(), Map.of(), 0);",
5252
" try {",
5353
" parser.parse(tokens);",
54-
" return Either.right(harvest(parser));",
54+
" return Either.right(extract(parser));",
5555
" } catch (ExFailure e) {",
5656
" return Either.left(e.toError(createModel()));",
5757
" }",
@@ -73,7 +73,7 @@ void testBasicGenerated() {
7373
" });",
7474
" }",
7575
"",
76-
" private Arguments harvest(RestParser<Void> parser) throws ExFailure {",
76+
" private Arguments extract(RestParser<Void> parser) throws ExFailure {",
7777
" List<String> _hello = parser.rest()",
7878
" .map(StringConverter.create(Function.identity()))",
7979
" .collect(Eithers.firstFailure())",
@@ -161,7 +161,7 @@ void testPublicParser() {
161161
" RestParser<Void> parser = RestParser.create(Map.of(), Map.of(), 0);",
162162
" try {",
163163
" parser.parse(tokens);",
164-
" return Either.right(harvest(parser));",
164+
" return Either.right(extract(parser));",
165165
" } catch (ExFailure e) {",
166166
" return Either.left(e.toError(createModel()));",
167167
" }",
@@ -183,7 +183,7 @@ void testPublicParser() {
183183
" });",
184184
" }",
185185
"",
186-
" private Arguments harvest(RestParser<Void> parser) throws ExFailure {",
186+
" private Arguments extract(RestParser<Void> parser) throws ExFailure {",
187187
" List<String> _hello = parser.rest()",
188188
" .map(StringConverter.create(Function.identity()))",
189189
" .collect(Eithers.firstFailure())",

0 commit comments

Comments
 (0)