in spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java [349:412]
protected abstract E createEndpoint(Object endpointBean, EndpointId id, boolean enabledByDefault,
Collection<O> operations);
/**
* 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
*/
protected abstract O createOperation(EndpointId endpointId, DiscoveredOperationMethod operationMethod,
OperationInvoker invoker);
/**
* Create an {@link OperationKey} for the given operation.
* @param operation the source operation
* @return the operation key
*/
protected abstract OperationKey createOperationKey(O operation);
/**
* A key generated for an {@link Operation} based on specific criteria from the actual
* operation implementation.
*/
protected static final class OperationKey {
private final Object key;
private final Supplier<String> description;
/**
* Create a new {@link OperationKey} instance.
* @param key the underlying key for the operation
* @param description a human readable description of the key
*/
public OperationKey(Object key, Supplier<String> description) {
Assert.notNull(key, "Key must not be null");
Assert.notNull(description, "Description must not be null");
this.key = key;
this.description = description;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return this.key.equals(((OperationKey) obj).key);
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public String toString() {
return this.description.get();
}
}