public class UriPart extends Object
This class represents a part of the uri as parsed by the UriTemplateParser.
The UriTemplate parser can produce multiple UriParts, each representing a part of the Uri. One part can represent either a static uri part without a template or a template with a single variable. The template with multiple variables generates multiple UriParts, each for a single variable.
Modifier and Type | Method and Description |
---|---|
String |
getGroup()
Return the matching group of the template represented by this
UriPart |
String |
getPart()
Return the string value representing this UriPart.
|
boolean |
isTemplate()
Returns true when this
UriPart is a template with a variable |
static String |
percentEncode(String toEncode,
UriComponent.Type componentType,
boolean encode)
Percent encode the given text
|
String |
resolve(Object value,
UriComponent.Type componentType,
boolean encode)
Returns the resolved template variable when the value object is passed
|
boolean |
throwWhenNoTemplateArg()
Informs whether throw
IllegalArgumentException when no object value matches the template argument |
public String getPart()
public String getGroup()
UriPart
public boolean isTemplate()
UriPart
is a template with a variablepublic String resolve(Object value, UriComponent.Type componentType, boolean encode)
value
- the value object to be used to resolve the template variablecomponentType
- the component type that can be used to determine the encoding os special charactersencode
- the hint whether to encode or notpublic boolean throwWhenNoTemplateArg()
IllegalArgumentException
when no object value matches the template argumenttrue
when when no object value matches the template argument and
IllegalArgumentException
is to be thrownpublic static String percentEncode(String toEncode, UriComponent.Type componentType, boolean encode)
toEncode
- the given text to encodecomponentType
- the component type to encodeencode
- toEncode or contextualEncodeCopyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.