Browse Source

Support method chaining in AbstractAotProcessor.Settings

See gh-29266
pull/29302/head
Sam Brannen 2 years ago
parent
commit
f00e4b230f
  1. 20
      spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java
  2. 13
      spring-context/src/test/java/org/springframework/context/aot/ContextAotProcessorTests.java
  3. 13
      spring-test/src/test/java/org/springframework/test/context/aot/TestAotProcessorTests.java

20
spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java

@ -123,9 +123,11 @@ public abstract class AbstractAotProcessor { @@ -123,9 +123,11 @@ public abstract class AbstractAotProcessor {
/**
* 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;
}
/**
@ -139,9 +141,11 @@ public abstract class AbstractAotProcessor { @@ -139,9 +141,11 @@ public abstract class AbstractAotProcessor {
/**
* 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;
}
/**
@ -155,9 +159,11 @@ public abstract class AbstractAotProcessor { @@ -155,9 +159,11 @@ public abstract class AbstractAotProcessor {
/**
* 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;
}
/**
@ -172,9 +178,11 @@ public abstract class AbstractAotProcessor { @@ -172,9 +178,11 @@ public abstract class AbstractAotProcessor {
* 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;
}
/**
@ -189,9 +197,11 @@ public abstract class AbstractAotProcessor { @@ -189,9 +197,11 @@ public abstract class AbstractAotProcessor {
* 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;
}
/**

13
spring-context/src/test/java/org/springframework/context/aot/ContextAotProcessorTests.java

@ -128,13 +128,12 @@ class ContextAotProcessorTests { @@ -128,13 +128,12 @@ class ContextAotProcessorTests {
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

13
spring-test/src/test/java/org/springframework/test/context/aot/TestAotProcessorTests.java

@ -109,13 +109,12 @@ class TestAotProcessorTests extends AbstractAotTests { @@ -109,13 +109,12 @@ class TestAotProcessorTests extends AbstractAotTests {
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);
}
}

Loading…
Cancel
Save