Skip to content

Commit c05aacd

Browse files
committed
- implement parameter nullability
1 parent 1d60d42 commit c05aacd

8 files changed

Lines changed: 475 additions & 119 deletions

File tree

jooby/src/main/java/io/jooby/trpc/TrpcReader.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@
55
*/
66
package io.jooby.trpc;
77

8+
import io.jooby.exception.MissingValueException;
9+
810
/**
911
* A sequential reader used at RUNTIME for multi-argument methods. Allows the APT code to extract
1012
* arguments one by one, preserving primitives.
1113
*/
1214
public interface TrpcReader extends AutoCloseable {
1315

14-
// Primitive extractors to avoid autoboxing
16+
boolean nextIsNull(String name);
17+
18+
// 2. Default helper for non-nullable primitives to fail fast
19+
default void requireNext(String name) {
20+
if (nextIsNull(name)) {
21+
throw new MissingValueException(name);
22+
}
23+
}
24+
1525
int nextInt(String name);
1626

1727
long nextLong(String name);

0 commit comments

Comments
 (0)