Interface FileTranslationEventHandlerContext
public interface FileTranslationEventHandlerContext
Represents the context passed to
FileTranslationEventHandler.onCompleteWithSuccess(FileTranslationEventHandlerContext)
or FileTranslationEventHandler.onCompleteWithError(FileTranslationEventHandlerContext)
after a translation batch run finishes.
Carries both the successful and the failed positional results for the batch, along with the
connection name and the rehydrated FileTranslationParameters that were attached to the
original FileTranslationBatchRequest.
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the API name of the provider connection that was used for this translation run, as specified viaFileTranslationBatchRequest.Builder.withConnectionName(String).Retrieves one result perFileTranslationInputthat failed during this batch's asynchronous translation run.<T> TgetParameter(String name, FileTranslationParameterValueType<T> valueType) Retrieves a parameter value from theFileTranslationParametersbag that was attached to the originalFileTranslationBatchRequest.<T extends FileTranslationParameterValue>
TgetParameter(String name, Class<T> returnType) Retrieves a custom-object parameter value from theFileTranslationParametersinstance that was attached to the originalFileTranslationBatchRequest.Retrieves one result perFileTranslationInputthat was successfully translated in this batch.
-
Method Details
-
getResults
List<FileTranslationResultSuccess> getResults()Retrieves one result perFileTranslationInputthat was successfully translated in this batch. UsePositionalResult.getInputPosition()to correlate each result back to its corresponding input.- Returns:
- an immutable list of
FileTranslationResultSuccessobjects. Never null; may be empty if every input failed.
-
getErrors
List<FileTranslationResultError> getErrors()Retrieves one result perFileTranslationInputthat failed during this batch's asynchronous translation run. UsePositionalResult.getInputPosition()to correlate each result back to its corresponding input.- Returns:
- an immutable list of
FileTranslationResultErrorobjects. Never null; may be empty if every input succeeded.
-
getConnectionName
String getConnectionName()Retrieves the API name of the provider connection that was used for this translation run, as specified viaFileTranslationBatchRequest.Builder.withConnectionName(String).- Returns:
- the connection name. Never null.
-
getParameter
Retrieves a parameter value from theFileTranslationParametersbag that was attached to the originalFileTranslationBatchRequest.- Type Parameters:
T- the expected Java type- Parameters:
name- the parameter name used when callingFileTranslationParameters.Builder.appendValue(String, Object). Cannot be null.valueType- the type token fromFileTranslationParameterValueType. Cannot be null.- Returns:
- the parameter value, or
nullif no parameter with that name exists
-
getParameter
Retrieves a custom-object parameter value from theFileTranslationParametersinstance that was attached to the originalFileTranslationBatchRequest.- Type Parameters:
T- the expected concrete type- Parameters:
name- the parameter name used when callingFileTranslationParameters.Builder.appendValue(String, Object). Cannot be null.returnType- the concrete class of theFileTranslationParameterValueimplementation. Cannot be null.- Returns:
- the parameter value, or
nullif no parameter with that name exists
-