use of com.google.template.soy.shared.internal.GuiceSimpleScope in project closure-templates by google.
the class SoyCodeForPySubject method enterScope.
private GuiceSimpleScope.InScope enterScope() {
GuiceSimpleScope apiCallScope1 = injector.getInstance(Key.get(GuiceSimpleScope.class, ApiCall.class));
GuiceSimpleScope.InScope scope = apiCallScope1.enter();
ApiCallScopeUtils.seedSharedParams(scope, null, BidiGlobalDir.LTR);
return scope;
}
use of com.google.template.soy.shared.internal.GuiceSimpleScope in project closure-templates by google.
the class SharedTestUtils method simulateNewApiCall.
/**
* Simulates the start of a new Soy API call by entering/re-entering the ApiCallScope and seeding
* scoped values common to all backends. Does not seed backend-specific API call parameters.
*
* @param injector The Guice injector responsible for injections during the API call.
* @param msgBundle The bundle of translated messages, or null to use the messages from the Soy
* source.
* @param bidiGlobalDir The bidi global directionality. If null, it is derived from the msgBundle
* locale, if any, otherwise ltr.
* @return The ApiCallScope object (for use by the caller of this method to seed additional API
* call parameters, such as backend-specific parameters).
*/
public static GuiceSimpleScope.InScope simulateNewApiCall(Injector injector, @Nullable SoyMsgBundle msgBundle, @Nullable BidiGlobalDir bidiGlobalDir) {
GuiceSimpleScope apiCallScope = injector.getInstance(Key.get(GuiceSimpleScope.class, ApiCall.class));
GuiceSimpleScope.InScope inscope = apiCallScope.enter();
ApiCallScopeUtils.seedSharedParams(inscope, msgBundle, bidiGlobalDir);
return inscope;
}
Aggregations