org.eclipse.lsp4j.jsonrpc.json.JsonRpcMethodProvider Java Examples

The following examples show how to use org.eclipse.lsp4j.jsonrpc.json.JsonRpcMethodProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Launcher.java    From lsp4j with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Gather all JSON-RPC methods from the local and remote services.
 */
protected Map<String, JsonRpcMethod> getSupportedMethods() {
	Map<String, JsonRpcMethod> supportedMethods = new LinkedHashMap<>();
	// Gather the supported methods of remote interfaces
	for (Class<?> interface_ : remoteInterfaces) {
		supportedMethods.putAll(ServiceEndpoints.getSupportedMethods(interface_));
	}
	
	// Gather the supported methods of local services
	for (Object localService : localServices) {
		if (localService instanceof JsonRpcMethodProvider) {
			JsonRpcMethodProvider rpcMethodProvider = (JsonRpcMethodProvider) localService;
			supportedMethods.putAll(rpcMethodProvider.supportedMethods());
		} else {
			supportedMethods.putAll(ServiceEndpoints.getSupportedMethods(localService.getClass()));
		}
	}
	
	return supportedMethods;
}