Remove deprecated Endpoint ID methods

See gh-14773
pull/14822/head
Phillip Webb 6 years ago
parent 1bf97e9b5e
commit 18319ac276

@ -38,12 +38,6 @@ class MappingWebEndpointPathMapper implements PathMapper {
.put(EndpointId.fromPropertyValue(id), path));
}
@Override
@Deprecated
public String getRootPath(String endpointId) {
return getRootPath(EndpointId.of(endpointId));
}
@Override
public String getRootPath(EndpointId endpointId) {
return this.pathMapping.getOrDefault(endpointId, endpointId.toLowerCaseString());

@ -80,7 +80,7 @@ public class CloudFoundryWebEndpointDiscovererTests {
private void load(Class<?> configuration,
Consumer<CloudFoundryWebEndpointDiscoverer> consumer) {
this.load((id) -> null, (id) -> id, configuration, consumer);
this.load((id) -> null, (id) -> id.toString(), configuration, consumer);
}
private void load(Function<EndpointId, Long> timeToLive,

@ -44,21 +44,6 @@ public abstract class AbstractExposableEndpoint<O extends Operation>
* @param id the endpoint id
* @param enabledByDefault if the endpoint is enabled by default
* @param operations the endpoint operations
* @deprecated since 2.0.6 in favor of
* {@link #AbstractExposableEndpoint(EndpointId, boolean, Collection)}
*/
@Deprecated
public AbstractExposableEndpoint(String id, boolean enabledByDefault,
Collection<? extends O> operations) {
this(EndpointId.of(id), enabledByDefault, operations);
}
/**
* Create a new {@link AbstractExposableEndpoint} instance.
* @param id the endpoint id
* @param enabledByDefault if the endpoint is enabled by default
* @param operations the endpoint operations
* @since 2.0.6
*/
public AbstractExposableEndpoint(EndpointId id, boolean enabledByDefault,
Collection<? extends O> operations) {
@ -70,8 +55,8 @@ public abstract class AbstractExposableEndpoint<O extends Operation>
}
@Override
public String getId() {
return this.id.toString();
public EndpointId getEndpointId() {
return this.id;
}
@Override

@ -28,22 +28,11 @@ import java.util.Collection;
*/
public interface ExposableEndpoint<O extends Operation> {
/**
* Returns the id of the endpoint.
* @return the id
* @deprecated since 2.0.6 in favor of {@link #getEndpointId()}
*/
@Deprecated
String getId();
/**
* Return the endpoint ID.
* @return the endpoint ID
* @since 2.0.6
*/
default EndpointId getEndpointId() {
return EndpointId.of(getId());
}
EndpointId getEndpointId();
/**
* Returns if the endpoint is enabled by default.

@ -47,24 +47,6 @@ public abstract class AbstractDiscoveredEndpoint<O extends Operation>
* @param id the ID of the endpoint
* @param enabledByDefault if the endpoint is enabled by default
* @param operations the endpoint operations
* @deprecated since 2.0.6 in favor of
* {@link #AbstractDiscoveredEndpoint(EndpointDiscoverer, Object, EndpointId, boolean, Collection)}
*/
@Deprecated
public AbstractDiscoveredEndpoint(EndpointDiscoverer<?, ?> discoverer,
Object endpointBean, String id, boolean enabledByDefault,
Collection<? extends O> operations) {
this(discoverer, endpointBean, EndpointId.of(id), enabledByDefault, operations);
}
/**
* Create a new {@link AbstractDiscoveredEndpoint} instance.
* @param discoverer the discoverer that discovered the endpoint
* @param endpointBean the primary source bean
* @param id the ID of the endpoint
* @param enabledByDefault if the endpoint is enabled by default
* @param operations the endpoint operations
* @since 2.0.6
*/
public AbstractDiscoveredEndpoint(EndpointDiscoverer<?, ?> discoverer,
Object endpointBean, EndpointId id, boolean enabledByDefault,

@ -340,26 +340,8 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
* @param enabledByDefault if the endpoint is enabled by default
* @param operations the endpoint operations
* @return a created endpoint (a {@link DiscoveredEndpoint} is recommended)
* @since 2.0.6
*/
protected E createEndpoint(Object endpointBean, EndpointId id,
boolean enabledByDefault, Collection<O> operations) {
return createEndpoint(endpointBean, (id != null) ? id.toString() : null,
enabledByDefault, operations);
}
/**
* Factory method called to create the {@link ExposableEndpoint endpoint}.
* @param endpointBean the source endpoint bean
* @param id the ID of the endpoint
* @param enabledByDefault if the endpoint is enabled by default
* @param operations the endpoint operations
* @return a created endpoint (a {@link DiscoveredEndpoint} is recommended)
* @deprecated Since 2.0.6 in favor of
* {@link #createEndpoint(Object, EndpointId, boolean, Collection)}
*/
@Deprecated
protected abstract E createEndpoint(Object endpointBean, String id,
protected abstract E createEndpoint(Object endpointBean, EndpointId id,
boolean enabledByDefault, Collection<O> operations);
/**
@ -368,25 +350,8 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
* @param operationMethod the operation method
* @param invoker the invoker to use
* @return a created operation
* @since 2.0.6
*/
protected O createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
return createOperation((endpointId != null) ? endpointId.toString() : null,
operationMethod, invoker);
}
/**
* Factory method to create an {@link Operation endpoint operation}.
* @param endpointId the endpoint id
* @param operationMethod the operation method
* @param invoker the invoker to use
* @return a created operation
* @deprecated since 2.0.6 in favor of
* {@link #createOperation(EndpointId, DiscoveredOperationMethod, OperationInvoker)}
*/
@Deprecated
protected abstract O createOperation(String endpointId,
protected abstract O createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker);
/**

@ -35,26 +35,8 @@ public interface OperationInvokerAdvisor {
* @param parameters the operation parameters
* @param invoker the invoker to advise
* @return an potentially new operation invoker with support for additional features
* @since 2.0.6
*/
default OperationInvoker apply(EndpointId endpointId, OperationType operationType,
OperationParameters parameters, OperationInvoker invoker) {
return apply((endpointId != null) ? endpointId.toString() : null, operationType,
parameters, invoker);
}
/**
* Apply additional functionality to the given invoker.
* @param endpointId the endpoint ID
* @param operationType the operation type
* @param parameters the operation parameters
* @param invoker the invoker to advise
* @return an potentially new operation invoker with support for additional features
* @deprecated since 2.0.6 in favor of
* {@link #apply(EndpointId, OperationType, OperationParameters, OperationInvoker)}
*/
@Deprecated
OperationInvoker apply(String endpointId, OperationType operationType,
OperationInvoker apply(EndpointId endpointId, OperationType operationType,
OperationParameters parameters, OperationInvoker invoker);
}

@ -41,13 +41,6 @@ public class CachingOperationInvokerAdvisor implements OperationInvokerAdvisor {
this.endpointIdTimeToLive = endpointIdTimeToLive;
}
@Override
@Deprecated
public OperationInvoker apply(String endpointId, OperationType operationType,
OperationParameters parameters, OperationInvoker invoker) {
return apply(EndpointId.of(endpointId), operationType, parameters, invoker);
}
@Override
public OperationInvoker apply(EndpointId endpointId, OperationType operationType,
OperationParameters parameters, OperationInvoker invoker) {

@ -54,14 +54,6 @@ public class JmxEndpointDiscoverer
super(applicationContext, parameterValueMapper, invokerAdvisors, filters);
}
@Override
@Deprecated
protected ExposableJmxEndpoint createEndpoint(Object endpointBean, String id,
boolean enabledByDefault, Collection<JmxOperation> operations) {
return createEndpoint(endpointBean, EndpointId.of(id), enabledByDefault,
operations);
}
@Override
protected ExposableJmxEndpoint createEndpoint(Object endpointBean, EndpointId id,
boolean enabledByDefault, Collection<JmxOperation> operations) {
@ -69,13 +61,6 @@ public class JmxEndpointDiscoverer
operations);
}
@Override
@Deprecated
protected JmxOperation createOperation(String endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
return createOperation(EndpointId.of(endpointId), operationMethod, invoker);
}
@Override
protected JmxOperation createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {

@ -90,19 +90,6 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
* endpoint cannot be found.
* @param endpointId the endpoint ID
* @return the root path or {@code null}
* @deprecated since 2.0.6 in favor of {@link #getRootPath(EndpointId)}
*/
@Deprecated
public String getRootPath(String endpointId) {
return getRootPath(EndpointId.of(endpointId));
}
/**
* Return the root path for the endpoint with the given ID or {@code null} if the
* endpoint cannot be found.
* @param endpointId the endpoint ID
* @return the root path or {@code null}
* @since 2.0.6
*/
public String getRootPath(EndpointId endpointId) {
PathMappedEndpoint endpoint = getEndpoint(endpointId);
@ -114,19 +101,6 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
* endpoint cannot be found.
* @param endpointId the endpoint ID
* @return the full path or {@code null}
* @deprecated since 2.0.6 in favor of {@link #getPath(EndpointId)}
*/
@Deprecated
public String getPath(String endpointId) {
return getPath(EndpointId.of(endpointId));
}
/**
* Return the full path for the endpoint with the given ID or {@code null} if the
* endpoint cannot be found.
* @param endpointId the endpoint ID
* @return the full path or {@code null}
* @since 2.0.6
*/
public String getPath(EndpointId endpointId) {
return getPath(getEndpoint(endpointId));
@ -153,19 +127,6 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
* endpoint cannot be found.
* @param endpointId the endpoint ID
* @return the path mapped endpoint or {@code null}
* @deprecated since 2.0.6 in favor of {@link #getEndpoint(EndpointId)}
*/
@Deprecated
public PathMappedEndpoint getEndpoint(String endpointId) {
return getEndpoint(EndpointId.of(endpointId));
}
/**
* Return the {@link PathMappedEndpoint} with the given ID or {@code null} if the
* endpoint cannot be found.
* @param endpointId the endpoint ID
* @return the path mapped endpoint or {@code null}
* @since 2.0.6
*/
public PathMappedEndpoint getEndpoint(EndpointId endpointId) {
return this.endpoints.get(endpointId);

@ -33,40 +33,15 @@ public interface PathMapper {
* Resolve the root path for the endpoint with the specified {@code endpointId}.
* @param endpointId the id of an endpoint
* @return the path of the endpoint
* @since 2.0.6
*/
default String getRootPath(EndpointId endpointId) {
return getRootPath((endpointId != null) ? endpointId.toString() : null);
}
/**
* Resolve the root path for the endpoint with the specified {@code endpointId}.
* @param endpointId the id of an endpoint
* @return the path of the endpoint
* @deprecated since 2.0.6 in favor of {@link #getRootPath(EndpointId)}
*/
@Deprecated
String getRootPath(String endpointId);
String getRootPath(EndpointId endpointId);
/**
* Returns an {@link PathMapper} that uses the endpoint ID as the path.
* @return an {@link PathMapper} that uses the lowercase endpoint ID as the path
*/
static PathMapper useEndpointId() {
return new PathMapper() {
@Override
@Deprecated
public String getRootPath(String endpointId) {
return getRootPath(EndpointId.of(endpointId));
}
@Override
public String getRootPath(EndpointId endpointId) {
return endpointId.toLowerCaseString();
}
};
return (id) -> id.toLowerCaseString();
}

@ -67,14 +67,6 @@ public class ControllerEndpointDiscoverer
|| AnnotatedElementUtils.isAnnotated(type, RestControllerEndpoint.class);
}
@Override
@Deprecated
protected ExposableControllerEndpoint createEndpoint(Object endpointBean, String id,
boolean enabledByDefault, Collection<Operation> operations) {
return createEndpoint(endpointBean, (id != null) ? EndpointId.of(id) : null,
enabledByDefault, operations);
}
@Override
protected ExposableControllerEndpoint createEndpoint(Object endpointBean,
EndpointId id, boolean enabledByDefault, Collection<Operation> operations) {
@ -83,13 +75,6 @@ public class ControllerEndpointDiscoverer
enabledByDefault);
}
@Override
@Deprecated
protected Operation createOperation(String endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
return createOperation(EndpointId.of(endpointId), operationMethod, invoker);
}
@Override
protected Operation createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {

@ -66,14 +66,6 @@ public class ServletEndpointDiscoverer
return AnnotatedElementUtils.isAnnotated(type, ServletEndpoint.class);
}
@Override
@Deprecated
protected ExposableServletEndpoint createEndpoint(Object endpointBean, String id,
boolean enabledByDefault, Collection<Operation> operations) {
return createEndpoint(endpointBean, EndpointId.of(id), enabledByDefault,
operations);
}
@Override
protected ExposableServletEndpoint createEndpoint(Object endpointBean, EndpointId id,
boolean enabledByDefault, Collection<Operation> operations) {
@ -82,13 +74,6 @@ public class ServletEndpointDiscoverer
enabledByDefault);
}
@Override
@Deprecated
protected Operation createOperation(String endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
return createOperation(EndpointId.of(endpointId), operationMethod, invoker);
}
@Override
protected Operation createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {

@ -68,14 +68,6 @@ public class WebEndpointDiscoverer
this.requestPredicateFactory = new RequestPredicateFactory(endpointMediaTypes);
}
@Override
@Deprecated
protected ExposableWebEndpoint createEndpoint(Object endpointBean, String id,
boolean enabledByDefault, Collection<WebOperation> operations) {
return createEndpoint(endpointBean, EndpointId.of(id), enabledByDefault,
operations);
}
@Override
protected ExposableWebEndpoint createEndpoint(Object endpointBean, EndpointId id,
boolean enabledByDefault, Collection<WebOperation> operations) {
@ -84,13 +76,6 @@ public class WebEndpointDiscoverer
enabledByDefault, operations);
}
@Override
@Deprecated
protected WebOperation createOperation(String endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
return createOperation(EndpointId.of(endpointId), operationMethod, invoker);
}
@Override
protected WebOperation createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {

@ -223,13 +223,6 @@ public class DiscoveredOperationsFactoryTests {
return invoker;
}
@Override
@Deprecated
public OperationInvoker apply(String endpointId, OperationType operationType,
OperationParameters parameters, OperationInvoker invoker) {
throw new IllegalStateException();
}
public EndpointId getEndpointId() {
return this.endpointId;
}

@ -263,8 +263,8 @@ public class EndpointDiscovererTests {
public void getEndpointsShouldApplyFilters() {
load(SpecializedEndpointsConfiguration.class, (context) -> {
EndpointFilter<SpecializedExposableEndpoint> filter = (endpoint) -> {
String id = endpoint.getId();
return !id.equals("specialized");
EndpointId id = endpoint.getEndpointId();
return !id.equals(EndpointId.of("specialized"));
};
SpecializedEndpointDiscoverer discoverer = new SpecializedEndpointDiscoverer(
context, Collections.singleton(filter));
@ -519,12 +519,6 @@ public class EndpointDiscovererTests {
super(applicationContext, parameterValueMapper, invokerAdvisors, filters);
}
@Override
protected TestExposableEndpoint createEndpoint(Object endpointBean, String id,
boolean enabledByDefault, Collection<TestOperation> operations) {
throw new IllegalStateException();
}
@Override
protected TestExposableEndpoint createEndpoint(Object endpointBean, EndpointId id,
boolean enabledByDefault, Collection<TestOperation> operations) {
@ -533,7 +527,7 @@ public class EndpointDiscovererTests {
}
@Override
protected TestOperation createOperation(String endpointId,
protected TestOperation createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
return new TestOperation(operationMethod, invoker);
}
@ -559,13 +553,6 @@ public class EndpointDiscovererTests {
Collections.emptyList(), filters);
}
@Override
protected SpecializedExposableEndpoint createEndpoint(Object endpointBean,
String id, boolean enabledByDefault,
Collection<SpecializedOperation> operations) {
throw new IllegalStateException();
}
@Override
protected SpecializedExposableEndpoint createEndpoint(Object endpointBean,
EndpointId id, boolean enabledByDefault,
@ -575,7 +562,7 @@ public class EndpointDiscovererTests {
}
@Override
protected SpecializedOperation createOperation(String endpointId,
protected SpecializedOperation createOperation(EndpointId endpointId,
DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
return new SpecializedOperation(operationMethod, invoker);
}

@ -19,6 +19,8 @@ package org.springframework.boot.actuate.endpoint.jmx;
import java.util.Arrays;
import java.util.Collection;
import org.springframework.boot.actuate.endpoint.EndpointId;
/**
* Test {@link ExposableJmxEndpoint} implementation.
*
@ -37,8 +39,8 @@ public class TestExposableJmxEndpoint implements ExposableJmxEndpoint {
}
@Override
public String getId() {
return "test";
public EndpointId getEndpointId() {
return EndpointId.of("test");
}
@Override

@ -182,7 +182,8 @@ public class WebEndpointDiscovererTests {
@Test
public void getEndpointsWhenHasCacheWithTtlShouldCacheReadOperationWithTtlValue() {
load((id) -> 500L, (id) -> id, TestEndpointConfiguration.class, (discoverer) -> {
load((id) -> 500L, (id) -> id.toString(), TestEndpointConfiguration.class,
(discoverer) -> {
Map<EndpointId, ExposableWebEndpoint> endpoints = mapEndpoints(
discoverer.getEndpoints());
assertThat(endpoints).containsOnlyKeys(EndpointId.of("test"));
@ -245,7 +246,7 @@ public class WebEndpointDiscovererTests {
}
private void load(Class<?> configuration, Consumer<WebEndpointDiscoverer> consumer) {
this.load((id) -> null, (id) -> id, configuration, consumer);
this.load((id) -> null, (id) -> id.toString(), configuration, consumer);
}
private void load(Function<EndpointId, Long> timeToLive,

Loading…
Cancel
Save