IndexableBuilder

public abstract class IndexableBuilder extends Object
Known Direct Subclasses

The basic abstract builder to construct an Indexable.

Protected Constructor Summary

IndexableBuilder(String type)
Builder for a basic Indexable.

Public Method Summary

final Indexable
build()
Finalize building the object.
T
put(String key, double... values)
Sets one or multiple double values for a property, replacing its previous values.
T
put(String key, boolean... values)
Sets one or multiple boolean values for a property, replacing its previous values.
T
put(String key, byte[] byteArray)
Sets byte array for a property, replacing its previous values.
T
put(String key, Indexable... values)
Sets one or multiple Indexable values for a property, replacing its previous values.
T
put(String key, String... values)
Sets one or multiple string values for a property, replacing its previous values.
T
put(String key, long... values)
Sets one or multiple long values for a property, replacing its previous values.
T
setAlternateName(String... alternateNames)
Sets the alternate names for the content.
final T
setDescription(String description)
Sets the optional description of the content.
T
setId(String id)
Sets the ID for the Indexable.
final T
setImage(String url)
Sets the image of the content.
final <S extends IndexableBuilder<?>> T
setIsPartOf(S... collections)
Sets the sub-group or collection that this Indexable is part of.
final T
setKeywords(String... keywords)
Sets the keywords of the Indexable.
T
setMetadata(Indexable.Metadata.Builder metadataBuilder)
Sets the metadata.
final T
setName(String name)
Sets the name of the content, must not be null.
final T
setSameAs(String webUrl)
Sets the corresponding web URL.
final T
setUrl(String url)
Sets the URL.

Protected Method Summary

<S extends IndexableBuilder<?>> T
put(String key, S... values)
Sets one or multiple Indexable values for a property.

Inherited Method Summary

Protected Constructors

protected IndexableBuilder (String type)

Builder for a basic Indexable.

Parameters
type The schema.org type of the Indexable, must not be null or empty.

Public Methods

public final Indexable build ()

Finalize building the object. The Indexable being returned can be put into the index via the AppIndex interface.

public T put (String key, double... values)

Sets one or multiple double values for a property, replacing its previous values.

Parameters
key The schema.org property. Must not be null.
values The boolean values of the schema.org property.

public T put (String key, boolean... values)

Sets one or multiple boolean values for a property, replacing its previous values.

Parameters
key The schema.org property. Must not be null.
values The boolean values of the schema.org property.

public T put (String key, byte[] byteArray)

Sets byte array for a property, replacing its previous values.

This can be used to cache custom data in the Indexable that the client application can use during querying (to avoid having to look up the data in their own storage).

Parameters
key The schema.org property. Must not be null.
byteArray The byte array of the schema.org property.

public T put (String key, Indexable... values)

Sets one or multiple Indexable values for a property, replacing its previous values.

Parameters
key The schema.org property. Must not be null.
values The values represented as an Indexable. Null values are ignored. Indexable values must be constructed using Indexable.Metadata.Builder or convenience methods.

public T put (String key, String... values)

Sets one or multiple string values for a property, replacing its previous values.

Parameters
key The schema.org property. Must not be null.
values The string values of the schema.org property. Null values are ignored.

public T put (String key, long... values)

Sets one or multiple long values for a property, replacing its previous values.

Parameters
key The schema.org property. Must not be null.
values The long values of the schema.org property.

public T setAlternateName (String... alternateNames)

Sets the alternate names for the content.

public final T setDescription (String description)

Sets the optional description of the content.

Parameters
description The description of the content.

public T setId (String id)

Sets the ID for the Indexable.

public final T setImage (String url)

Sets the image of the content.

Parameters
url The web URL or content URI of the image.

public final T setIsPartOf (S... collections)

Sets the sub-group or collection that this Indexable is part of.

public final T setKeywords (String... keywords)

Sets the keywords of the Indexable. For example, email message can have keywords like promotion, finance; photograph can have the keywords for people, object and the place name where the photograph was taken.

Parameters
keywords The keywords of the Indexable. Null values are ignored.

public T setMetadata (Indexable.Metadata.Builder metadataBuilder)

Sets the metadata. If not invoked default metadata values are applied.

May only be called once and only on top-level Indexable values.

Parameters
metadataBuilder The Indexable.Metadata.Builder which builds the metadata.

public final T setName (String name)

Sets the name of the content, must not be null. For more information, visit these guidelines for providing a descriptive name.

public final T setSameAs (String webUrl)

Sets the corresponding web URL. The web URL is a reference web page that unambiguously indicates the item's identity.

Parameters
webUrl The reference web page that unambiguously indicates the item's identity.

public final T setUrl (String url)

Sets the URL. The URL must be openable by the app. This is mandatory to be set. The URL uniquely identifies the Indexable within the app.

Parameters
url The deep link URL which is not longer than Indexable.MAX_URL_LENGTH and openable by the app. The URL must be handled by app intent filter. Find detailed information on handling deep links here.

Protected Methods

protected T put (String key, S... values)

Sets one or multiple Indexable values for a property.

Parameters
key The schema.org property. Must not be null.
values The values represented as an IndexableBuilder. Null values are ignored.