TextLinks.Builder

public static final class TextLinks.Builder
extends Object

java.lang.Object
   ↳ android.view.textclassifier.TextLinks.Builder


A builder to construct a TextLinks instance.

Summary

Public constructors

TextLinks.Builder(String fullText)

Create a new TextLinks.Builder.

Public methods

TextLinks.Builder addLink(int start, int end, Map<StringFloat> entityScores)

Adds a TextLink.

TextLinks.Builder addLink(int start, int end, Map<StringFloat> entityScores, Bundle extras)

Adds a TextLink.

TextLinks build()

Constructs a TextLinks instance.

TextLinks.Builder clearTextLinks()

Removes all TextLinks.

TextLinks.Builder setExtras(Bundle extras)

Sets the extended data.

Inherited methods

Public constructors

TextLinks.Builder

Added in API level 28
public TextLinks.Builder (String fullText)

Create a new TextLinks.Builder.

Parameters
fullText String: The full text to annotate with links This value must never be null.

Public methods

addLink

Added in API level 28
public TextLinks.Builder addLink (int start, 
                int end, 
                Map<StringFloat> entityScores)

Adds a TextLink.

Parameters
start int: The start index of the identified subsequence

end int: The end index of the identified subsequence

entityScores Map: A mapping of entity type to confidence score This value must never be null.

Returns
TextLinks.Builder

Throws
IllegalArgumentException if entityScores is null or empty.

addLink

Added in API level 29
public TextLinks.Builder addLink (int start, 
                int end, 
                Map<StringFloat> entityScores, 
                Bundle extras)

Adds a TextLink.

Parameters
start int

end int

entityScores Map: This value must never be null.

extras Bundle: An optional bundle containing custom data related to this TextLink This value must never be null.

Returns
TextLinks.Builder This value will never be null.

build

Added in API level 28
public TextLinks build ()

Constructs a TextLinks instance.

Returns
TextLinks the constructed TextLinks This value will never be null.

clearTextLinks

Added in API level 28
public TextLinks.Builder clearTextLinks ()

Removes all TextLinks.

Returns
TextLinks.Builder This value will never be null.

setExtras

Added in API level 29
public TextLinks.Builder setExtras (Bundle extras)

Sets the extended data.

Parameters
extras Bundle: This value may be null.

Returns
TextLinks.Builder this builder This value will never be null.