Skip to content

Commit

Permalink
Support method chaining in AbstractAotProcessor.Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Oct 10, 2022
1 parent 7ed42ca commit f00e4b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ public static class Settings {
/**
* Set the output directory for generated sources.
* @param sourceOutput the location of generated sources
* @return this settings object for method chaining
*/
public void setSourceOutput(Path sourceOutput) {
public Settings setSourceOutput(Path sourceOutput) {
this.sourceOutput = sourceOutput;
return this;
}

/**
Expand All @@ -139,9 +141,11 @@ public Path getSourceOutput() {
/**
* Set the output directory for generated resources.
* @param resourceOutput the location of generated resources
* @return this settings object for method chaining
*/
public void setResourceOutput(Path resourceOutput) {
public Settings setResourceOutput(Path resourceOutput) {
this.resourceOutput = resourceOutput;
return this;
}

/**
Expand All @@ -155,9 +159,11 @@ public Path getResourceOutput() {
/**
* Set the output directory for generated classes.
* @param classOutput the location of generated classes
* @return this settings object for method chaining
*/
public void setClassOutput(Path classOutput) {
public Settings setClassOutput(Path classOutput) {
this.classOutput = classOutput;
return this;
}

/**
Expand All @@ -172,9 +178,11 @@ public Path getClassOutput() {
* Set the group ID of the application.
* @param groupId the group ID of the application, used to locate
* {@code native-image.properties}
* @return this settings object for method chaining
*/
public void setGroupId(String groupId) {
public Settings setGroupId(String groupId) {
this.groupId = groupId;
return this;
}

/**
Expand All @@ -189,9 +197,11 @@ public String getGroupId() {
* Set the artifact ID of the application.
* @param artifactId the artifact ID of the application, used to locate
* {@code native-image.properties}
* @return this settings object for method chaining
*/
public void setArtifactId(String artifactId) {
public Settings setArtifactId(String artifactId) {
this.artifactId = artifactId;
return this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,12 @@ private static class DemoContextAotProcessor extends ContextAotProcessor {

private static Settings createSettings(Path sourceOutput, Path resourceOutput,
Path classOutput, String groupId, String artifactId) {
Settings settings = new Settings();
settings.setSourceOutput(sourceOutput);
settings.setResourceOutput(resourceOutput);
settings.setClassOutput(classOutput);
settings.setArtifactId(artifactId);
settings.setGroupId(groupId);
return settings;
return new Settings()
.setSourceOutput(sourceOutput)
.setResourceOutput(resourceOutput)
.setClassOutput(classOutput)
.setArtifactId(artifactId)
.setGroupId(groupId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,12 @@ private static class DemoTestAotProcessor extends TestAotProcessor {

private static Settings createSettings(Path sourceOutput, Path resourceOutput, Path classOutput, String groupId,
String artifactId) {
Settings settings = new Settings();
settings.setSourceOutput(sourceOutput);
settings.setResourceOutput(resourceOutput);
settings.setClassOutput(classOutput);
settings.setArtifactId(artifactId);
settings.setGroupId(groupId);
return settings;
return new Settings()
.setSourceOutput(sourceOutput)
.setResourceOutput(resourceOutput)
.setClassOutput(classOutput)
.setArtifactId(artifactId)
.setGroupId(groupId);
}
}

Expand Down

0 comments on commit f00e4b2

Please sign in to comment.