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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

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.