Package com.azure.core.annotation
Annotation Type HostParam
-
@Retention(RUNTIME) @Target(PARAMETER) public @interface HostParam
Annotation to annotate replacement of parameterized segments in a dynamicHost
.You provide the value, which should be the same (case sensitive) with the parameterized segments in '{}' in the host, unless there's only one parameterized segment, then you can leave the value empty. This is extremely useful when the designer of the API interface doesn't know about the named parameters in the host.
Example 1: Named parameters
@Host("{accountName}.{suffix}") interface DatalakeService { @GET("jobs/{jobIdentity}") Job getJob(@HostParam("accountName") String accountName, @HostParam("suffix") String suffix, @PathParam ("jobIdentity") jobIdentity); }
Example 2: Unnamed parameter
@Host(KEY_VAULT_ENDPOINT) interface KeyVaultService { @GET("secrets/{secretName}") Secret get(@HostParam String vaultName, @PathParam("secretName") String secretName); }
-
-
Element Detail
-
value
String value
The name of the variable in the endpoint uri template which will be replaced with the value of the parameter annotated with this annotation.- Returns:
- The name of the variable in the endpoint uri template which will be replaced with the value of the parameter annotated with this annotation.
-
-
-
encoded
boolean encoded
A value true for this argument indicates that value ofvalue()
is already encoded hence engine should not encode it, by default value will be encoded.- Returns:
- Whether or not this argument is already encoded.
- Default:
- true
-
-