Class UriPart
- java.lang.Object
-
- org.glassfish.jersey.uri.internal.UriPart
-
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetGroup()Return the matching group of the template represented by thisUriPartStringgetPart()Return the string value representing this UriPart.booleanisTemplate()Returns true when thisUriPartis a template with a variablestatic StringpercentEncode(String toEncode, UriComponent.Type componentType, boolean encode)Percent encode the given textStringresolve(Object value, UriComponent.Type componentType, boolean encode)Returns the resolved template variable when the value object is passedbooleanthrowWhenNoTemplateArg()Informs whether throwIllegalArgumentExceptionwhen no object value matches the template argument
-
-
-
Method Detail
-
getPart
public String getPart()
Return the string value representing this UriPart. It can either be static content or a template.- Returns:
- string value representing this UriPart
-
getGroup
public String getGroup()
Return the matching group of the template represented by thisUriPart- Returns:
- the matching group
-
isTemplate
public boolean isTemplate()
Returns true when thisUriPartis a template with a variable- Returns:
- true when a template
-
resolve
public String resolve(Object value, UriComponent.Type componentType, boolean encode)
Returns the resolved template variable when the value object is passed- Parameters:
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 not- Returns:
- the resolved template
-
throwWhenNoTemplateArg
public boolean throwWhenNoTemplateArg()
Informs whether throwIllegalArgumentExceptionwhen no object value matches the template argument- Returns:
truewhen when no object value matches the template argument andIllegalArgumentExceptionis to be thrown
-
percentEncode
public static String percentEncode(String toEncode, UriComponent.Type componentType, boolean encode)
Percent encode the given text- Parameters:
toEncode- the given text to encodecomponentType- the component type to encodeencode- toEncode or contextualEncode- Returns:
- the encoded text
-
-