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

Builder(String fullText)

Create a new TextLinks.Builder.

Public methods

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

Adds a TextLink.

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

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

Builder

Added in API level 28
public Builder (String fullText)

Create a new TextLinks.Builder.

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

Public methods

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 cannot be null.

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

Returns
TextLinks.Builder This value cannot be null.

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 cannot be null.

Returns
TextLinks.Builder This value cannot be null.

Throws
IllegalArgumentException if entityScores is null or empty.

build

Added in API level 28
public TextLinks build ()

Constructs a TextLinks instance.

Returns
TextLinks the constructed TextLinks This value cannot be null.

clearTextLinks

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

Removes all TextLinks.

Returns
TextLinks.Builder This value cannot 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 cannot be null.