public ST createStringTemplate(CompiledST impl) { ST st = new ST(); st.impl = impl; st.groupThatCreatedThisInstance = this; if (impl.formalArguments != null) { st.locals = new Object[impl.formalArguments.size()]; Arrays.fill(st.locals, ST.EMPTY_ATTR); } return st; }
/** Create singleton template for use with dictionary values */ public ST createSingleton(Token templateToken) { String template; if (templateToken.getType() == GroupParser.BIGSTRING) { template = Misc.strip(templateToken.getText(), 2); } else { template = Misc.strip(templateToken.getText(), 1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }