Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unclear in docs if config can be reused and relevant classes are thread safe. #3191

@timothyBrake

Description

@timothyBrake

E.g.: Can I reuse parts spanding more requests like the response of the getServcie() and have that injected in another class? Are these classes thread safe or should a developer always create a new Translate object?

@Inject
private Translate translate; 
// Somewhere else defined and injected like
// Translate translate = TranslateOptions.newBuilder().setApiKey(googleApiKey).build().getService();
...
public void doTranslation(){
    Translation translation = translate.translate(
                            "Some text here",
                            Translate.TranslateOption.sourceLanguage(sourceLanguage),
                            Translate.TranslateOption.targetLanguage(targetLanguage));
}

Metadata

Metadata

Assignees

Labels

type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions