Skip to content

Commit 8848066

Browse files
committed
Polish
1 parent 000600c commit 8848066

File tree

9 files changed

+63
-52
lines changed

9 files changed

+63
-52
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,17 @@ public Ssl getSsl() {
148148
public static class Ssl {
149149

150150
/**
151-
* Whether to enable SSL support. If enabled, {@code mail.<protocol>.ssl.enable}
152-
* property is set to {@code true}.
151+
* Whether to enable SSL support. If enabled, 'mail.(protocol).ssl.enable'
152+
* property is set to 'true'.
153153
*/
154154
private boolean enabled = false;
155155

156156
/**
157-
* SSL bundle name. If not null, {@code mail.<protocol>.ssl.socketFactory}
158-
* property is set to a {@code SSLSocketFactory} obtained from the corresponding
159-
* SSL bundle.
157+
* SSL bundle name. If set, 'mail.(protocol).ssl.socketFactory' property is set to
158+
* an SSLSocketFactory obtained from the corresponding SSL bundle.
160159
* <p>
161-
* Note that the {@code STARTTLS} command can use the corresponding
162-
* {@code SSLSocketFactory}, even if {@code mail.<protocol>.ssl.enable} property
163-
* is not set.
160+
* Note that the STARTTLS command can use the corresponding SSLSocketFactory, even
161+
* if the 'mail.(protocol).ssl.enable' property is not set.
164162
*/
165163
private String bundle;
166164

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderPropertiesConfiguration.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ private void applyProperties(MailProperties properties, JavaMailSenderImpl sende
6464
}
6565
Properties javaMailProperties = asProperties(properties.getProperties());
6666
String protocol = properties.getProtocol();
67-
if (!StringUtils.hasLength(protocol)) {
68-
protocol = "smtp";
69-
}
67+
protocol = (!StringUtils.hasLength(protocol)) ? "smtp" : protocol;
7068
Ssl ssl = properties.getSsl();
7169
if (ssl.isEnabled()) {
7270
javaMailProperties.setProperty("mail." + protocol + ".ssl.enable", "true");

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/r2dbc/ProxyConnectionFactoryCustomizer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@
1616

1717
package org.springframework.boot.autoconfigure.r2dbc;
1818

19-
import io.r2dbc.proxy.ProxyConnectionFactory;
19+
import io.r2dbc.proxy.ProxyConnectionFactory.Builder;
2020

2121
/**
22-
* Callback interface that can be used to customize a
23-
* {@link ProxyConnectionFactory.Builder}.
22+
* Callback interface that can be used to customize a {@link Builder}.
2423
*
2524
* @author Tadaya Tsuyukubo
2625
* @since 3.4.0
2726
*/
27+
@FunctionalInterface
2828
public interface ProxyConnectionFactoryCustomizer {
2929

3030
/**
31-
* Callback to customize a {@link ProxyConnectionFactory.Builder} instance.
31+
* Callback to customize a {@link Builder} instance.
3232
* @param builder the builder to customize
3333
*/
34-
void customize(ProxyConnectionFactory.Builder builder);
34+
void customize(Builder builder);
3535

3636
}

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/StartCommand.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,28 @@ public enum StartCommand {
3434
/**
3535
* Start using {@code docker compose up}.
3636
*/
37-
UP {
38-
@Override
39-
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments) {
40-
dockerCompose.up(logLevel, arguments);
41-
}
42-
},
37+
UP(DockerCompose::up),
4338

4439
/**
4540
* Start using {@code docker compose start}.
4641
*/
47-
START {
48-
@Override
49-
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments) {
50-
dockerCompose.start(logLevel, arguments);
51-
}
52-
};
53-
54-
abstract void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments);
42+
START(DockerCompose::start);
43+
44+
private final Command command;
45+
46+
StartCommand(Command command) {
47+
this.command = command;
48+
}
49+
50+
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments) {
51+
this.command.applyTo(dockerCompose, logLevel, arguments);
52+
}
53+
54+
@FunctionalInterface
55+
private interface Command {
56+
57+
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments);
58+
59+
}
5560

5661
}

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/StopCommand.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,28 @@ public enum StopCommand {
3434
/**
3535
* Stop using {@code docker compose down}.
3636
*/
37-
DOWN {
38-
@Override
39-
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments) {
40-
dockerCompose.down(timeout, arguments);
41-
}
42-
},
37+
DOWN(DockerCompose::down),
4338

4439
/**
4540
* Stop using {@code docker compose stop}.
4641
*/
47-
STOP {
48-
@Override
49-
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments) {
50-
dockerCompose.stop(timeout, arguments);
51-
}
52-
};
53-
54-
abstract void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments);
42+
STOP(DockerCompose::stop);
43+
44+
private final Command command;
45+
46+
StopCommand(Command command) {
47+
this.command = command;
48+
}
49+
50+
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments) {
51+
this.command.applyTo(dockerCompose, timeout, arguments);
52+
}
53+
54+
@FunctionalInterface
55+
private interface Command {
56+
57+
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments);
58+
59+
}
5560

5661
}

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/service/connection/postgres/PostgresEnvironment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ class PostgresEnvironment {
4545
}
4646

4747
private String extractPassword(Map<String, String> env) {
48-
if (hasTrustHostAuthMethod(env)) {
48+
if (isUsingTrustHostAuthMethod(env)) {
4949
return null;
5050
}
5151
String password = env.getOrDefault("POSTGRES_PASSWORD", env.get("POSTGRESQL_PASSWORD"));
5252
Assert.state(StringUtils.hasLength(password), "PostgreSQL password must be provided");
5353
return password;
5454
}
5555

56-
private Boolean hasTrustHostAuthMethod(Map<String, String> env) {
56+
private boolean isUsingTrustHostAuthMethod(Map<String, String> env) {
5757
String hostAuthMethod = env.get("POSTGRES_HOST_AUTH_METHOD");
5858
return "trust".equals(hostAuthMethod);
5959
}

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public BuildRequest withBuilder(ImageReference builder) {
175175
* @param trustBuilder {@code true} if the builder should be treated as trusted,
176176
* {@code false} otherwise
177177
* @return an updated build request
178+
* @since 3.4.0
178179
*/
179180
public BuildRequest withTrustBuilder(boolean trustBuilder) {
180181
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/NestedConfigurationProperty.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
*
7575
* @author Stephane Nicoll
7676
* @author Phillip Webb
77+
* @author Jared Bates
7778
* @since 1.2.0
7879
*/
7980
@Target({ ElementType.FIELD, ElementType.RECORD_COMPONENT, ElementType.METHOD })

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jms/ConnectionFactoryUnwrapper.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@
2626
* pooling.
2727
*
2828
* @author Stephane Nicoll
29-
* @since 6.4.0
29+
* @since 3.4.0
3030
*/
31-
public abstract class ConnectionFactoryUnwrapper {
31+
public final class ConnectionFactoryUnwrapper {
32+
33+
private ConnectionFactoryUnwrapper() {
34+
}
3235

3336
/**
3437
* Return the native {@link ConnectionFactory} by unwrapping it from a cache or pool
@@ -38,17 +41,17 @@ public abstract class ConnectionFactoryUnwrapper {
3841
* @return the native connection factory that it wraps, if any
3942
*/
4043
public static ConnectionFactory unwrap(ConnectionFactory connectionFactory) {
41-
if (connectionFactory instanceof CachingConnectionFactory ccf) {
42-
return unwrap(ccf.getTargetConnectionFactory());
44+
if (connectionFactory instanceof CachingConnectionFactory cachingConnectionFactory) {
45+
return unwrap(cachingConnectionFactory.getTargetConnectionFactory());
4346
}
4447
ConnectionFactory unwrapedConnectionFactory = unwrapFromJmsPoolConnectionFactory(connectionFactory);
4548
return (unwrapedConnectionFactory != null) ? unwrap(unwrapedConnectionFactory) : connectionFactory;
4649
}
4750

4851
private static ConnectionFactory unwrapFromJmsPoolConnectionFactory(ConnectionFactory connectionFactory) {
4952
try {
50-
if (connectionFactory instanceof JmsPoolConnectionFactory poolConnectionFactory) {
51-
return (ConnectionFactory) poolConnectionFactory.getConnectionFactory();
53+
if (connectionFactory instanceof JmsPoolConnectionFactory jmsPoolConnectionFactory) {
54+
return (ConnectionFactory) jmsPoolConnectionFactory.getConnectionFactory();
5255
}
5356
}
5457
catch (Throwable ex) {

0 commit comments

Comments
 (0)