Package io.wcm.sling.commons.request
Class QueryStringBuilder
- java.lang.Object
-
- io.wcm.sling.commons.request.QueryStringBuilder
-
@ProviderType public final class QueryStringBuilder extends Object
Builds a property URL-encoded query string.
-
-
Constructor Summary
Constructors Constructor Description QueryStringBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable Stringbuild()Build query string.@NotNull QueryStringBuilderparam(@NotNull String name, @Nullable Object value)Add parameter to query string.@NotNull QueryStringBuilderparams(@NotNull Map<String,Object> values)Add map of parameters to query string.
-
-
-
Method Detail
-
param
@NotNull public @NotNull QueryStringBuilder param(@NotNull @NotNull String name, @Nullable @Nullable Object value)
Add parameter to query string.- Parameters:
name- Parameter namevalue- Parameter value. Will be converted to string. If value is an array orIterablethe value items will be added as separate parameters.- Returns:
- this
-
params
@NotNull public @NotNull QueryStringBuilder params(@NotNull @NotNull Map<String,Object> values)
Add map of parameters to query string.- Parameters:
values- Map with parameter names and values. Values will be converted to strings. If a value is an array orIterablethe value items will be added as separate parameters.- Returns:
- this
-
build
@Nullable public @Nullable String build()
Build query string.- Returns:
- Query string or null if query string contains no parameters at all.
-
-