Skip to content

Commit 9a282e7

Browse files
author
Robert James Oxspring
committed
*Builder.reset() now returns this builder instance
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@130101 13f79535-47bb-0310-9956-ffa450edef68
1 parent 832d7af commit 9a282e7

6 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public final Argument create() {
9393
* Resets the ArgumentBuilder to the defaults for a new Argument. The
9494
* method should be called automatically at the end of a create() call.
9595
*/
96-
public final void reset() {
96+
public final ArgumentBuilder reset() {
9797
name = "arg";
9898
description = null;
9999
minimum = 0;
@@ -104,6 +104,7 @@ public final void reset() {
104104
consumeRemaining = "--";
105105
defaultValues = null;
106106
id = 0;
107+
return this;
107108
}
108109

109110
/**

src/java/org/apache/commons/cli2/builder/CommandBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ public Command create() {
7676
* Resets the CommandBuilder to the defaults for a new Command. The method
7777
* should be called automatically at the end of a create() call.
7878
*/
79-
public void reset() {
79+
public CommandBuilder reset() {
8080
preferredName = null;
8181
description = null;
8282
aliases = new HashSet();
8383
required = false;
8484
argument = null;
8585
children = null;
8686
id = 0;
87+
return this;
8788
}
8889

8990
/**

src/java/org/apache/commons/cli2/builder/DefaultOptionBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public DefaultOption create() throws IllegalStateException {
116116
/**
117117
* Resets the builder
118118
*/
119-
public void reset() {
119+
public DefaultOptionBuilder reset() {
120120
preferredName = null;
121121
description = null;
122122
aliases = new HashSet();
@@ -125,6 +125,7 @@ public void reset() {
125125
argument = null;
126126
children = null;
127127
id = 0;
128+
return this;
128129
}
129130

130131
/**

src/java/org/apache/commons/cli2/builder/GroupBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ public Group create() {
5656
/**
5757
* Resets the builder
5858
*/
59-
public void reset() {
59+
public GroupBuilder reset() {
6060
name = null;
6161
description = null;
6262
options = new ArrayList();
6363
minimum = 0;
6464
maximum = Integer.MAX_VALUE;
65+
return this;
6566
}
6667

6768
/**

src/java/org/apache/commons/cli2/builder/PatternBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ public Option create() {
9191
/**
9292
* Resets this builder
9393
*/
94-
public void reset() {
94+
public PatternBuilder reset() {
9595
options.clear();
96+
return this;
9697
}
9798

9899
private void createOption(

src/java/org/apache/commons/cli2/builder/SwitchBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public Switch create() {
9898
/**
9999
* Resets the builder
100100
*/
101-
public void reset() {
101+
public SwitchBuilder reset() {
102102
description = null;
103103
preferredName = null;
104104
required = false;
@@ -107,6 +107,7 @@ public void reset() {
107107
children = null;
108108
id = 0;
109109
switchDefault = null;
110+
return this;
110111
}
111112

112113
/**

0 commit comments

Comments
 (0)