azure-docs-sdk-java/docs-ref-autogen/com.azure.core.annotation.H...

40 строки
3.5 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.annotation.HostParam"
fullName: "com.azure.core.annotation.HostParam"
name: "HostParam"
nameWithType: "HostParam"
summary: "Annotation to annotate replacement of parameterized segments in a dynamic <xref uid=\"com.azure.core.annotation.Host\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Host\"></xref>."
syntax: "public interface HostParam implements Annotation"
methods:
- uid: "com.azure.core.annotation.HostParam.encoded()"
fullName: "com.azure.core.annotation.HostParam.encoded()"
name: "encoded()"
nameWithType: "HostParam.encoded()"
summary: "A value true for this argument indicates that value of <xref uid=\"com.azure.core.annotation.HostParam.value()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HostParam#value()\"></xref> is already encoded hence engine should not encode it, by default value will be encoded."
modifiers:
- "abstract"
syntax: "public abstract boolean encoded()"
desc: "A value true for this argument indicates that value of <xref uid=\"com.azure.core.annotation.HostParam.value()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HostParam#value()\"></xref> is already encoded hence engine should not encode it, by default value will be encoded."
returns:
description: "Whether this argument is already encoded."
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.annotation.HostParam.value()"
fullName: "com.azure.core.annotation.HostParam.value()"
name: "value()"
nameWithType: "HostParam.value()"
summary: "The name of the variable in the endpoint uri template which will be replaced with the value of the parameter annotated with this annotation."
modifiers:
- "abstract"
syntax: "public abstract String value()"
desc: "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:
description: "The name of the variable in the endpoint uri template which will be replaced with the value of the\n parameter annotated with this annotation."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
type: "interface"
desc: "Annotation to annotate replacement of parameterized segments in a dynamic <xref uid=\"com.azure.core.annotation.Host\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Host\"></xref>.\n\nYou 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.\n\n**Example 1: Named parameters**\n\n```java\n@Host(\"{accountName}.{suffix}\")\n interface DatalakeService {\n @Get(\"jobs/{jobIdentity}\")\n Job getJob(@HostParam(\"accountName\") String accountName,\n @HostParam(\"suffix\") String suffix,\n @PathParam(\"jobIdentity\") String jobIdentity);\n }\n```\n\n**Example 2: Unnamed parameter**\n\n```java\nString KEY_VAULT_ENDPOINT = \"{vaultName}\";\n\n @Host(KEY_VAULT_ENDPOINT)\n interface KeyVaultService {\n @Get(\"secrets/{secretName}\")\n Secret get(@HostParam(\"vaultName\") String vaultName, @PathParam(\"secretName\") String secretName);\n }\n```"
implements:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Annotation.html\">Annotation</a>"
metadata: {}
package: "com.azure.core.annotation"
artifact: com.azure:azure-core:1.32.0