Skip to content

Commit 3df4e4e

Browse files
committed
- fix/update javadoc on jsonrpc annotation
1 parent beb4370 commit 3df4e4e

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

jooby/src/main/java/io/jooby/annotation/JsonRpc.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,30 @@
1111
import java.lang.annotation.Target;
1212

1313
/**
14-
* Marks a class and its methods as a JSON-RPC 2.0 endpoint. *
14+
* Marks a class or its methods as a JSON-RPC 2.0 endpoint.
1515
*
16-
* <p>To expose a method via JSON-RPC, the method <b>must</b> be annotated with {@code @JsonRpc}. If
17-
* a class contains methods annotated with {@code @JsonRpc}, the class itself can optionally be
18-
* annotated to define a common namespace. *
16+
* <h3>Discovery Rules:</h3>
1917
*
20-
* <h3>Routing Rules:</h3>
18+
* <ul>
19+
* <li><b>Implicit Mapping:</b> If a class is annotated with {@code @JsonRpc} and <b>no</b>
20+
* methods are explicitly annotated, <b>all</b> public methods are automatically exposed as
21+
* JSON-RPC endpoints.
22+
* <li><b>Explicit Mapping:</b> If at least <b>one</b> method in the class is explicitly annotated
23+
* with {@code @JsonRpc}, implicit mapping is disabled. <b>Only</b> the annotated methods will
24+
* be exposed, requiring you to map any other desired endpoints one by one.
25+
* </ul>
26+
*
27+
* <h3>Naming & Routing Rules:</h3>
2128
*
2229
* <ul>
2330
* <li><b>Class Level (Namespace):</b> When applied to a class, the {@link #value()} defines the
2431
* namespace for all JSON-RPC methods within that class. If the annotation is present but the
25-
* value is empty, the simple class name (e.g., {@code MovieService}) is used as the
26-
* namespace. If the class is not annotated at all, the methods are registered without a
27-
* namespace. *
28-
* <li><b>Method Level (Method Name):</b> When applied to a method, the method is exposed over
29-
* JSON-RPC. The {@link #value()} defines the exact RPC method name. If the value is empty,
30-
* the actual Java/Kotlin method name is used.
32+
* value is empty (the default), <b>no namespace</b> is applied.
33+
* <li><b>Method Level (Method Name):</b> When applied to a method, the {@link #value()} defines
34+
* the exact RPC method name. If the value is empty, the actual Java/Kotlin method name is
35+
* used.
3136
* </ul>
3237
*
33-
* *
34-
*
3538
* <p>The final JSON-RPC method string expected by the dispatcher is formatted as {@code
3639
* "namespace.methodName"} (or just {@code "methodName"} if no namespace exists).
3740
*/
@@ -41,8 +44,8 @@
4144

4245
/**
4346
* The explicit namespace (when used on a class) or the explicit method name (when used on a
44-
* method). * @return The overridden name, or an empty string to use the defaults (Simple Class
45-
* Name or Method Name).
47+
* method). * @return The overridden name, or an empty string to use the defaults (no namespace
48+
* for classes, actual method name for methods).
4649
*/
4750
String value() default "";
4851
}

0 commit comments

Comments
 (0)