UrlBuilder
Stay organized with collections
Save and categorize content based on your preferences.
Constructs an URL from a MessageFormat
-style format string
and a set of columns to include in the URL.
Instances are immutable and thread-safe.
Public Method Summary
String
|
buildUrl(Map<String, ?> allColumnValues)
Builds the escaped URL.
|
static
UrlBuilder
|
|
Set<String>
|
getMissingColumns(Set<String> allColumns)
Gets the difference of the configured URL columns and the given set of all columns.
|
Inherited Method Summary
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Constants
public
static
final
String
CONFIG_COLUMNS
Constant Value:
"url.columns"
public
static
final
String
CONFIG_COLUMNS_TO_ESCAPE
Constant Value:
"url.columnsToEscape"
Constant Value:
"url.format"
Public Methods
public
String
buildUrl
(Map<String, ?> allColumnValues)
Builds the escaped URL. The given map of values may contain
unneeded columns, but it must contain all of the configured
.CONFIG_COLUMNS
columns.
Parameters
allColumnValues |
a map from column names to column values |
Returns
- the escaped URL, or null if one or more configured column names are missing
or have null values in
allColumnValues
public
static
UrlBuilder
fromConfiguration
()
Constructs an UrlBuilder
from the Configuration
Required configuration parameters:
.CONFIG_COLUMNS
- Specifies the column names whose values will be
substituted into the format to generate the URL.
Optional configuration parameters:
public
Set<String>
getMissingColumns
(Set<String> allColumns)
Gets the difference of the configured URL columns and the given set of all columns.
The difference will be empty if all of the URL columns are present in the given set.
Returns
- the difference of columns
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-18 UTC.
[null,null,["Last updated 2025-03-18 UTC."],[],[],null,["# UrlBuilder\n\npublic class **UrlBuilder** extends Object \nConstructs an URL from a [MessageFormat](/workspace/cloud-search/docs/reference/sdk/java/text/MessageFormat)-style format string\nand a set of columns to include in the URL.\n\n\nInstances are immutable and thread-safe. \n\n### Nested Class Summary\n\n|-------|---|---|-----------------------------------------------------|\n| class | [UrlBuilder.Builder](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder.Builder) || Builder for constructing instances of `UrlBuilder`. |\n\n### Constant Summary\n\n|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| String | [CONFIG_COLUMNS](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder#CONFIG_COLUMNS) | |\n| String | [CONFIG_COLUMNS_TO_ESCAPE](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder#CONFIG_COLUMNS_TO_ESCAPE) | |\n| String | [CONFIG_FORMAT](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder#CONFIG_FORMAT) | |\n\n### Public Method Summary\n\n|---------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| String | [buildUrl](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder#buildUrl(java.util.Map\u003cjava.lang.String, ?\u003e))(Map\\\u003cString, ?\\\u003e allColumnValues) Builds the escaped URL. |\n| static [UrlBuilder](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder) | [fromConfiguration](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder#fromConfiguration())() Constructs an `UrlBuilder` from the [Configuration](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/config/Configuration) Required configuration parameters: - [.CONFIG_COLUMNS](/workspace/cloud-search/docs/reference/sdk) - Specifies the column names whose values will be substituted into the format to generate the URL. |\n| Set\\\u003cString\\\u003e | [getMissingColumns](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder#getMissingColumns(java.util.Set\u003cjava.lang.String\u003e))(Set\\\u003cString\\\u003e allColumns) Gets the difference of the configured URL columns and the given set of all columns. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nConstants\n---------\n\n#### public static final String\n**CONFIG_COLUMNS**\n\n\u003cbr /\u003e\n\nConstant Value: \"url.columns\" \n\n#### public static final String\n**CONFIG_COLUMNS_TO_ESCAPE**\n\n\u003cbr /\u003e\n\nConstant Value: \"url.columnsToEscape\" \n\n#### public static final String\n**CONFIG_FORMAT**\n\n\u003cbr /\u003e\n\nConstant Value: \"url.format\"\n\nPublic Methods\n--------------\n\n#### public String\n**buildUrl**\n(Map\\\u003cString, ?\\\u003e allColumnValues)\n\nBuilds the escaped URL. The given map of values may contain\nunneeded columns, but it must contain all of the configured\n[.CONFIG_COLUMNS](/workspace/cloud-search/docs/reference/sdk) columns. \n\n##### Parameters\n\n| allColumnValues | a map from column names to column values |\n|-----------------|------------------------------------------|\n\n##### Returns\n\n- the escaped URL, or null if one or more configured column names are missing or have null values in `allColumnValues` \n\n#### public static [UrlBuilder](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/UrlBuilder)\n**fromConfiguration**\n()\n\nConstructs an `UrlBuilder` from the [Configuration](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/config/Configuration)\n\nRequired configuration parameters:\n\n- [.CONFIG_COLUMNS](/workspace/cloud-search/docs/reference/sdk) - Specifies the column names whose values will be substituted into the format to generate the URL.\n\nOptional configuration parameters:\n\n- [.CONFIG_FORMAT](/workspace/cloud-search/docs/reference/sdk) - Specifies the format of the URL. The default value is \"{0}\".\n- [.CONFIG_COLUMNS_TO_ESCAPE](/workspace/cloud-search/docs/reference/sdk) - Specifies the column names whose values will be URL escaped. Must be a subset of [.CONFIG_COLUMNS](/workspace/cloud-search/docs/reference/sdk).\n\n \u003cbr /\u003e\n\n##### Returns\n\n- an `UrlBuilder` \n\n#### public Set\\\u003cString\\\u003e\n**getMissingColumns**\n(Set\\\u003cString\\\u003e allColumns)\n\nGets the difference of the configured URL columns and the given set of all columns.\nThe difference will be empty if all of the URL columns are present in the given set. \n\n##### Parameters\n\n| allColumns | all columns |\n|------------|-------------|\n\n##### Returns\n\n- the difference of columns"]]