TextLinks.Builder

public static final class TextLinks.Builder
extends Object

java.lang.Object
   ↳ androidx.textclassifier.TextLinks.Builder


A builder to construct a TextLinks instance.

Summary

Public constructors

TextLinks.Builder(CharSequence fullText)

Create a new TextLinks.Builder.

Public methods

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

Adds a TextLink.

TextLinks build()

Constructs a TextLinks instance.

TextLinks.Builder clearTextLinks()

Removes all TextLinks.TextLinks.

TextLinks.Builder setExtras(Bundle extras)

Sets the extended, vendor specific data.

Inherited methods

Public constructors

TextLinks.Builder

public TextLinks.Builder (CharSequence fullText)

Create a new TextLinks.Builder.

Parameters
fullText CharSequence: The full text to annotate with links.

Public methods

addLink

public TextLinks.Builder addLink (int start, 
                int end, 
                Map<String, Float> entityScores)

Adds a TextLink.

Parameters
start int

end int

entityScores Map

Returns
TextLinks.Builder this instance.

Throws
IllegalArgumentException if entityScores is null or empty.

build

public TextLinks build ()

Constructs a TextLinks instance.

Returns
TextLinks the constructed TextLinks.

clearTextLinks

public TextLinks.Builder clearTextLinks ()

Removes all TextLinks.TextLinks.

Returns
TextLinks.Builder

setExtras

public TextLinks.Builder setExtras (Bundle extras)

Sets the extended, vendor specific data.

Parameters
extras Bundle

Returns
TextLinks.Builder