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

40 строки
4.1 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.annotation.PathParam"
fullName: "com.azure.core.annotation.PathParam"
name: "PathParam"
nameWithType: "PathParam"
summary: "Annotation to annotate replacement for a named path segment in REST endpoint URL."
syntax: "public interface **PathParam**</br> implements <a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Annotation.html\">Annotation</a>"
methods:
- uid: "com.azure.core.annotation.PathParam.encoded()"
fullName: "com.azure.core.annotation.PathParam.encoded()"
name: "encoded()"
nameWithType: "PathParam.encoded()"
summary: "A value true for this argument indicates that value of <xref uid=\"com.azure.core.annotation.PathParam.value()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PathParam#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.PathParam.value()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PathParam#value()\"></xref> is already encoded hence engine should not encode it, by default value will be encoded."
returns:
description: "Whether or not this path parameter is already encoded."
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.annotation.PathParam.value()"
fullName: "com.azure.core.annotation.PathParam.value()"
name: "value()"
nameWithType: "PathParam.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\n value of the 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 for a named path segment in REST endpoint URL.\n\nA parameter that is annotated with PathParam will be ignored if the \"uri template\" does not contain a path segment variable with name <xref uid=\"com.azure.core.annotation.PathParam.value()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PathParam#value()\"></xref>.\n\n**Example 1:**\n\n```java\n@Get(\"subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/\"\n + \"virtualMachines/\")\n VirtualMachine getByResourceGroup(@PathParam(\"subscriptionId\") String subscriptionId,\n @PathParam(\"resourceGroupName\") String rgName,\n @PathParam(\"foo\") String bar);\n\n // The value of parameters subscriptionId, resourceGroupName will be encoded and used to replace the\n // corresponding path segments {subscriptionId}, {resourceGroupName} respectively.\n```\n\n**Example 2: (A use case where PathParam.encoded=true will be used)**\n\n```java\n// It is possible that a path segment variable can be used to represent sub path:\n\n @Get(\"http://wq.com/foo/{subpath}/value\")\n String getValue(@PathParam(\"subpath\") String param1);\n\n // In this case, if consumer pass \"a/b\" as the value for param1 then the resolved url looks like:\n // \"http://wq.com/foo/a%2Fb/value\".\n```\n\n```java\n// For such cases the encoded attribute can be used:\n\n @Get(\"http://wq.com/foo/{subpath}/values\")\n List<String> getValues(@PathParam(value = \"subpath\", encoded = true) String param1);\n\n // In this case, if consumer pass \"a/b\" as the value for param1 then the resolved url looks as expected:\n // \"http://wq.com/foo/a/b/values\".\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.54.0