Polish
This commit is contained in:
@@ -22,6 +22,7 @@ package org.springframework.boot.endpoint;
|
||||
* @author Madhura Bhave
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface EndpointPathResolver {
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,8 +37,8 @@ public class Operation {
|
||||
* @param operationInvoker used to perform the operation
|
||||
* @param blocking whether or not this is a blocking operation
|
||||
*/
|
||||
public Operation(OperationType type,
|
||||
OperationInvoker operationInvoker, boolean blocking) {
|
||||
public Operation(OperationType type, OperationInvoker operationInvoker,
|
||||
boolean blocking) {
|
||||
this.type = type;
|
||||
this.invoker = operationInvoker;
|
||||
this.blocking = blocking;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class EndpointLinksResolver {
|
||||
Collection<EndpointInfo<WebEndpointOperation>> webEndpoints,
|
||||
String requestUrl) {
|
||||
String normalizedUrl = normalizeRequestUrl(requestUrl);
|
||||
Map<String, Link> links = new LinkedHashMap<String, Link>();
|
||||
Map<String, Link> links = new LinkedHashMap<>();
|
||||
links.put("self", new Link(normalizedUrl));
|
||||
for (EndpointInfo<WebEndpointOperation> endpoint : webEndpoints) {
|
||||
for (WebEndpointOperation operation : endpoint.getOperations()) {
|
||||
|
||||
@@ -213,16 +213,16 @@ public class WebEndpointReactiveHandlerMapping extends RequestMappingInfoHandler
|
||||
.onErrorReturn(ParameterMappingException.class,
|
||||
new ResponseEntity<>(HttpStatus.BAD_REQUEST))
|
||||
.defaultIfEmpty(
|
||||
new ResponseEntity<Object>(httpMethod == HttpMethod.GET
|
||||
new ResponseEntity<>(httpMethod == HttpMethod.GET
|
||||
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT));
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> toResponseEntity(Object response) {
|
||||
if (!(response instanceof WebEndpointResponse)) {
|
||||
return new ResponseEntity<Object>(response, HttpStatus.OK);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
|
||||
return new ResponseEntity<Object>(webEndpointResponse.getBody(),
|
||||
return new ResponseEntity<>(webEndpointResponse.getBody(),
|
||||
HttpStatus.valueOf(webEndpointResponse.getStatus()));
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,7 @@ public enum DatabaseDriver {
|
||||
* Firebird.
|
||||
*/
|
||||
FIREBIRD("Firebird", "org.firebirdsql.jdbc.FBDriver",
|
||||
"org.firebirdsql.ds.FBXADataSource",
|
||||
"SELECT 1 FROM RDB$DATABASE") {
|
||||
"org.firebirdsql.ds.FBXADataSource", "SELECT 1 FROM RDB$DATABASE") {
|
||||
|
||||
@Override
|
||||
protected Collection<String> getUrlPrefixes() {
|
||||
|
||||
@@ -24,6 +24,7 @@ import javax.sql.DataSource;
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface SchemaManagementProvider {
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,8 +77,8 @@ public class SpringPhysicalNamingStrategy implements PhysicalNamingStrategy {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an identifier for the specified details. By default this method will return
|
||||
* an identifier with the name adapted based on the result of
|
||||
* Get an identifier for the specified details. By default this method will return an
|
||||
* identifier with the name adapted based on the result of
|
||||
* {@link #isCaseInsensitive(JdbcEnvironment)}
|
||||
* @param name the name of the identifier
|
||||
* @param quoted if the identifier is quoted
|
||||
|
||||
@@ -90,8 +90,8 @@ import org.springframework.util.StringUtils;
|
||||
* Can be initialized using Spring's {@link ServletContextInitializer}s or Jetty
|
||||
* {@link Configuration}s.
|
||||
* <p>
|
||||
* Unless explicitly configured otherwise this factory will create servers that listen
|
||||
* for HTTP requests on port 8080.
|
||||
* Unless explicitly configured otherwise this factory will create servers that listen for
|
||||
* HTTP requests on port 8080.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
@@ -527,8 +527,8 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor
|
||||
}
|
||||
|
||||
/**
|
||||
* Post process the Jetty {@link WebAppContext} before it's used with the Jetty Server.
|
||||
* Subclasses can override this method to apply additional processing to the
|
||||
* Post process the Jetty {@link WebAppContext} before it's used with the Jetty
|
||||
* Server. Subclasses can override this method to apply additional processing to the
|
||||
* {@link WebAppContext}.
|
||||
* @param webAppContext the Jetty {@link WebAppContext}
|
||||
*/
|
||||
|
||||
@@ -89,8 +89,8 @@ import org.springframework.util.StringUtils;
|
||||
* {@link TomcatWebServer}s. Can be initialized using Spring's
|
||||
* {@link ServletContextInitializer}s or Tomcat {@link LifecycleListener}s.
|
||||
* <p>
|
||||
* Unless explicitly configured otherwise this factory will create containers that
|
||||
* listen for HTTP requests on port 8080.
|
||||
* Unless explicitly configured otherwise this factory will create containers that listen
|
||||
* for HTTP requests on port 8080.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -563,7 +563,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
|
||||
@ReadOperation
|
||||
public WebEndpointResponse<Resource> read() {
|
||||
return new WebEndpointResponse<Resource>(
|
||||
return new WebEndpointResponse<>(
|
||||
new ByteArrayResource(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }),
|
||||
200);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class JerseyWebEndpointIntegrationTests extends
|
||||
@Bean
|
||||
public ServletRegistrationBean<ServletContainer> servletContainer(
|
||||
ResourceConfig resourceConfig) {
|
||||
return new ServletRegistrationBean<ServletContainer>(
|
||||
return new ServletRegistrationBean<>(
|
||||
new ServletContainer(resourceConfig), "/*");
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class JerseyWebEndpointIntegrationTests extends
|
||||
Collection<Resource> resources = new JerseyEndpointResourceFactory()
|
||||
.createEndpointResources("endpoints",
|
||||
endpointDiscoverer.discoverEndpoints());
|
||||
resourceConfig.registerResources(new HashSet<Resource>(resources));
|
||||
resourceConfig.registerResources(new HashSet<>(resources));
|
||||
resourceConfig.register(JacksonFeature.class);
|
||||
resourceConfig.register(new ObjectMapperContextResolver(new ObjectMapper()),
|
||||
ContextResolver.class);
|
||||
|
||||
Reference in New Issue
Block a user