İngilizce dilinde oku

Aracılığıyla paylaş


HostParam Interface

Implements

public interface HostParam
implements Annotation

Annotation to annotate replacement of parameterized segments in a dynamic Host.

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

Java
@Host("{accountName}.{suffix}")
 interface DatalakeService {
     @Get("jobs/{jobIdentity}")
     Job getJob(@HostParam("accountName") String accountName,
         @HostParam("suffix") String suffix,
         @PathParam("jobIdentity") String jobIdentity);
 }

Example 2: Unnamed parameter

Java
String KEY_VAULT_ENDPOINT = "{vaultName}";

 @Host(KEY_VAULT_ENDPOINT)
 interface KeyVaultService {
     @Get("secrets/{secretName}")
     Secret get(@HostParam("vaultName") String vaultName, @PathParam("secretName") String secretName);
 }

Method Summary

Modifier and Type Method and Description
abstract boolean encoded()

A value true for this argument indicates that value of value() is already encoded hence engine should not encode it, by default value will be encoded.

abstract 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.

Method Details

encoded

public abstract boolean encoded()

A value true for this argument indicates that value of value() is already encoded hence engine should not encode it, by default value will be encoded.

Returns:

Whether this argument is already encoded.

value

public abstract 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.

Applies to

Azure SDK for Java

Latest