forked from avaje/avaje-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.java
58 lines (51 loc) · 1.25 KB
/
Client.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package io.avaje.http.api;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Marker annotation for client.
*
* <pre>{@code
* @Client
* interface CustomerApi {
* ...
* @Get("/{id}")
* Customer getById(long id);
*
* @Post
* long save(Customer customer);
* }
*
* }</pre>
*/
@Target(TYPE)
@Retention(RUNTIME)
public @interface Client {
/** Specify the path mapping request to the controller. */
String value() default "";
/**
* Flag to set whether to generate a Client Implementation. Set false if the interface exists merely to be extended by
* other client interfaces
*/
boolean generate() default true;
/**
* Specify <code>@Client.Import</code> on a package or class to refer to the client interface we
* want to generate.
*
* <pre>{@code
* @Client.Import(types = OtherApi.class)
* package org.example;
*
* }</pre>
*/
@Target({TYPE, PACKAGE})
@Retention(RUNTIME)
@interface Import {
/**
* Client interface types that we want to generate HTTP clients for.
*/
Class<?>[] value();
}
}