Skip to content

Commit ae7db65

Browse files
committed
- add javadoc for some jsonrpc
1 parent bf9d9f5 commit ae7db65

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

jooby/src/main/java/io/jooby/Jooby.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,18 @@ public Route.Set mount(@NonNull Router router) {
493493
return mount("/", router);
494494
}
495495

496+
/**
497+
* Mounts and registers a JSON-RPC service at the specified custom path.
498+
*
499+
* <p>This method initializes a JSON-RPC dispatcher for the given path if one does not already
500+
* exist, installs the dispatcher module into the application, and binds the provided {@link
501+
* JsonRpcService} to it. Multiple services can be added to the same path.
502+
*
503+
* @param path The URL path where the JSON-RPC endpoint will be exposed (e.g., "/api/rpc").
504+
* @param service The {@link JsonRpcService} instance containing the RPC methods to expose. Must
505+
* not be null.
506+
* @return This {@link Jooby} instance to allow for method chaining.
507+
*/
496508
public Jooby jsonRpc(String path, @NonNull JsonRpcService service) {
497509
if (dispatchers == null) {
498510
dispatchers = new HashMap<>();
@@ -509,6 +521,16 @@ public Jooby jsonRpc(String path, @NonNull JsonRpcService service) {
509521
return this;
510522
}
511523

524+
/**
525+
* Mounts and registers a JSON-RPC service at the default path {@code "/rpc"}.
526+
*
527+
* <p>This is a convenience method that delegates to {@link #jsonRpc(String, JsonRpcService)}
528+
* using the default endpoint path.
529+
*
530+
* @param service The {@link JsonRpcService} instance containing the RPC methods to expose. Must
531+
* not be null.
532+
* @return This {@link Jooby} instance to allow for method chaining.
533+
*/
512534
public Jooby jsonRpc(@NonNull JsonRpcService service) {
513535
return jsonRpc("/rpc", service);
514536
}

jooby/src/main/java/io/jooby/rpc/jsonrpc/JsonRpcService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
*/
1919
public interface JsonRpcService {
2020

21+
/**
22+
* List all RPC method exposed by this service.
23+
*
24+
* @return All RPC method exposed by this service.
25+
*/
2126
List<String> getMethods();
2227

2328
/**

0 commit comments

Comments
 (0)