Package io.wcm.sling.commons.request
Class QueryStringBuilder
java.lang.Object
io.wcm.sling.commons.request.QueryStringBuilder
Builds a property URL-encoded query string.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Stringbuild()Build query string.@NotNull QueryStringBuilderAdd parameter to query string.@NotNull QueryStringBuilderAdd map of parameters to query string.
-
Constructor Details
-
QueryStringBuilder
public QueryStringBuilder()
-
-
Method Details
-
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
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
Build query string.- Returns:
- Query string or null if query string contains no parameters at all.
-