TranslationResponseValue.Builder


public static final class TranslationResponseValue.Builder
extends Object

java.lang.Object
   ↳ android.view.translation.TranslationResponseValue.Builder


A builder for TranslationResponseValue

Summary

Public constructors

Builder(int statusCode)

Creates a new Builder.

Public methods

TranslationResponseValue build()

Builds the instance.

TranslationResponseValue.Builder setExtras(Bundle value)

Extra results associated with the translated text.

TranslationResponseValue.Builder setText(CharSequence value)

The translated text result.

TranslationResponseValue.Builder setTransliteration(CharSequence value)

The transliteration result of the translated text.

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 31
public Builder (int statusCode)

Creates a new Builder.

Parameters
statusCode int: The status code of this TranslationResponseValue.

If the status code is TranslationResponseValue.STATUS_ERROR, no values are attached, and all getters will return null. Value is TranslationResponseValue.STATUS_SUCCESS, or TranslationResponseValue.STATUS_ERROR

Public methods

build

Added in API level 31
public TranslationResponseValue build ()

Builds the instance. This builder should not be touched after calling this!

Returns
TranslationResponseValue This value cannot be null.

setExtras

Added in API level 31
public TranslationResponseValue.Builder setExtras (Bundle value)

Extra results associated with the translated text.

The bundle includes TranslationResponseValue.EXTRA_DEFINITIONS, obtained by Bundle.getBundle.

Parameters
value Bundle: This value cannot be null.

Returns
TranslationResponseValue.Builder This value cannot be null.

setText

Added in API level 31
public TranslationResponseValue.Builder setText (CharSequence value)

The translated text result.

Parameters
value CharSequence: This value cannot be null.

Returns
TranslationResponseValue.Builder This value cannot be null.

setTransliteration

Added in API level 31
public TranslationResponseValue.Builder setTransliteration (CharSequence value)

The transliteration result of the translated text.

This returns a CharSequence representation of the transliteration of the translated text.

Parameters
value CharSequence: This value cannot be null.

Returns
TranslationResponseValue.Builder This value cannot be null.