|
| 1 | +/* |
| 2 | + * Jooby https://jooby.io |
| 3 | + * Apache License Version 2.0 https://jooby.io/LICENSE.txt |
| 4 | + * Copyright 2014 Edgar Espina |
| 5 | + */ |
| 6 | +package io.jooby.annotation; |
| 7 | + |
| 8 | +import java.lang.annotation.Documented; |
| 9 | +import java.lang.annotation.ElementType; |
| 10 | +import java.lang.annotation.Retention; |
| 11 | +import java.lang.annotation.RetentionPolicy; |
| 12 | +import java.lang.annotation.Target; |
| 13 | + |
| 14 | +/** Marks a controller class or a specific route method for tRPC TypeScript generation. */ |
| 15 | +@Target({ElementType.TYPE, ElementType.METHOD}) |
| 16 | +@Retention(RetentionPolicy.RUNTIME) |
| 17 | +@Documented |
| 18 | +public @interface Trpc { |
| 19 | + |
| 20 | + @Target(ElementType.METHOD) |
| 21 | + @Retention(RetentionPolicy.RUNTIME) |
| 22 | + @Documented |
| 23 | + @interface Mutation { |
| 24 | + /** |
| 25 | + * Custom name for the tRPC procedure. |
| 26 | + * |
| 27 | + * <p>If applied to a method, this overrides the generated procedure name. If applied to a |
| 28 | + * class, this overrides the generated namespace/router name. |
| 29 | + * |
| 30 | + * @return The custom procedure name. Empty by default, which means the generator will use the |
| 31 | + * Java method or class name. |
| 32 | + */ |
| 33 | + String value() default ""; |
| 34 | + } |
| 35 | + |
| 36 | + @Target(ElementType.METHOD) |
| 37 | + @Retention(RetentionPolicy.RUNTIME) |
| 38 | + @Documented |
| 39 | + @interface Query { |
| 40 | + /** |
| 41 | + * Custom name for the tRPC procedure. |
| 42 | + * |
| 43 | + * <p>If applied to a method, this overrides the generated procedure name. If applied to a |
| 44 | + * class, this overrides the generated namespace/router name. |
| 45 | + * |
| 46 | + * @return The custom procedure name. Empty by default, which means the generator will use the |
| 47 | + * Java method or class name. |
| 48 | + */ |
| 49 | + String value() default ""; |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Custom name for the tRPC procedure or namespace. |
| 54 | + * |
| 55 | + * <p>If applied to a method, this overrides the generated procedure name. If applied to a class, |
| 56 | + * this overrides the generated namespace/router name. |
| 57 | + * |
| 58 | + * @return The custom procedure or namespace name. Empty by default, which means the generator |
| 59 | + * will use the Java method or class name. |
| 60 | + */ |
| 61 | + String value() default ""; |
| 62 | +} |
0 commit comments