DiscoveredJmxOperation(EndpointId endpointId, DiscoveredOperationMethod operationMethod, OperationInvoker invoker) { super(operationMethod, invoker); Method method = operationMethod.getMethod(); this.name = method.getName(); this.outputType = JmxType.get(method.getReturnType()); this.description = getDescription(method, () -> "Invoke " + this.name + " for endpoint " + endpointId); this.parameters = getParameters(operationMethod); }
private Collection<String> getProduces(DiscoveredOperationMethod operationMethod, Method method) { if (!operationMethod.getProducesMediaTypes().isEmpty()) { return operationMethod.getProducesMediaTypes(); } if (Void.class.equals(method.getReturnType()) || void.class.equals(method.getReturnType())) { return Collections.emptyList(); } if (producesResource(method)) { return Collections.singletonList("application/octet-stream"); } return this.endpointMediaTypes.getProduced(); }
public WebOperationRequestPredicate getRequestPredicate(EndpointId endpointId, String rootPath, DiscoveredOperationMethod operationMethod) { Method method = operationMethod.getMethod(); String path = getPath(rootPath, method); WebEndpointHttpMethod httpMethod = determineHttpMethod( operationMethod.getOperationType()); Collection<String> consumes = getConsumes(httpMethod, method); Collection<String> produces = getProduces(operationMethod, method); return new WebOperationRequestPredicate(path, httpMethod, consumes, produces); }
private O createOperation(EndpointId endpointId, Object target, Method method, OperationType operationType, Class<? extends Annotation> annotationType) { AnnotationAttributes annotationAttributes = AnnotatedElementUtils .getMergedAnnotationAttributes(method, annotationType); if (annotationAttributes == null) { return null; } DiscoveredOperationMethod operationMethod = new DiscoveredOperationMethod(method, operationType, annotationAttributes); OperationInvoker invoker = new ReflectiveOperationInvoker(target, operationMethod, this.parameterValueMapper); invoker = applyAdvisors(endpointId, operationMethod, invoker); return createOperation(endpointId, operationMethod, invoker); }
DiscoveredWebOperation(EndpointId endpointId, DiscoveredOperationMethod operationMethod, OperationInvoker invoker, WebOperationRequestPredicate requestPredicate) { super(operationMethod, invoker); Method method = operationMethod.getMethod(); this.id = getId(endpointId, method); this.blocking = getBlocking(method); this.requestPredicate = requestPredicate; }