/** * Define a function to be applied * * @param function function */ public void withFunction(Function<P, R> function) { withBiFunction((s, p) -> function.apply(p)); } }
public FunctionConfiguratorOneToOne<P, Double> resultAsDouble() { LOGGER.debug( "Configuring incoming request result: " + "method: " + method + ", " + "result object class: " + Double.class); return new FunctionConfiguratorOneToOne<>(requestHandlerManager, method, pClass, Double.class); }
private <P, R> void dtoToDto( String name, Class<P> pClass, Class<R> rClass, Function<P, R> function) { requestHandler .newConfiguration() .methodName("textDocument/" + name) .paramsAsDto(pClass) .resultAsDto(rClass) .withFunction(function); }
@PostConstruct private void configureMethodHandlers() { configurator .newConfiguration() .methodName("languageServer/initialize") .paramsAsString() .resultAsDto(ServerCapabilitiesDto.class) .withFunction(this::initialize); configurator .newConfiguration() .methodName("languageServer/getLanguageRegexes") .noParams() .resultAsListOfDto(LanguageRegexDto.class) .withSupplier(this::getLanguageRegexes); }
@Inject private void configureTestDetectionHandler(RequestHandlerConfigurator configurator) { configurator .newConfiguration() .methodName(Constants.TESTING_RPC_TEST_DETECTION_NAME) .paramsAsDto(TestDetectionContext.class) .resultAsDto(TestDetectionResult.class) .withBiFunction(this::handleTestDetection); }
public FunctionConfiguratorOneToOne<P, String> resultAsString() { LOGGER.debug( "Configuring incoming request result: " + "method: " + method + ", " + "result object class: " + String.class); return new FunctionConfiguratorOneToOne<>(requestHandlerManager, method, pClass, String.class); }
.paramsAsString() .resultAsString() .withFunction(this::getFileContent);
@Inject private void configureRunTestHandler(RequestHandlerConfigurator configurator) { configurator .newConfiguration() .methodName(Constants.RUN_TESTS_METHOD) .paramsAsDto(TestExecutionContext.class) .resultAsDto(TestLaunchResult.class) .withBiFunction(this::runTests); }
public FunctionConfiguratorOneToOne<P, Boolean> resultAsBoolean() { LOGGER.debug( "Configuring incoming request result: " + "method: " + method + ", " + "result object class: " + Boolean.class); return new FunctionConfiguratorOneToOne<>(requestHandlerManager, method, pClass, Boolean.class); }
public <R> FunctionConfiguratorOneToOne<P, R> resultAsDto(Class<R> rClass) { checkNotNull(rClass, "Result class must not be null"); LOGGER.debug( "Configuring incoming request result: " + "method: " + method + ", " + "result object class: " + rClass); return new FunctionConfiguratorOneToOne<>(requestHandlerManager, method, pClass, rClass); }