本文整理汇总了Java中groovy.text.GStringTemplateEngine类的典型用法代码示例。如果您正苦于以下问题:Java GStringTemplateEngine类的具体用法?Java GStringTemplateEngine怎么用?Java GStringTemplateEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GStringTemplateEngine类属于groovy.text包,在下文中一共展示了GStringTemplateEngine类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GroovyDocTemplateEngine
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
public GroovyDocTemplateEngine(GroovyDocTool tool, ResourceManager resourceManager,
String[] docTemplates,
String[] packageTemplates,
String[] classTemplates,
Properties properties) {
this.resourceManager = resourceManager;
this.properties = properties;
this.docTemplatePaths = Arrays.asList(docTemplates);
this.packageTemplatePaths = Arrays.asList(packageTemplates);
this.classTemplatePaths = Arrays.asList(classTemplates);
this.docTemplates = new LinkedHashMap<String, Template>();
this.packageTemplates = new LinkedHashMap<String, Template>();
this.classTemplates = new LinkedHashMap<String, Template>();
engine = new GStringTemplateEngine();
}
示例2: generateScript
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
public static String generateScript(GroovyMap groovyMap, String templateName) throws GFacException {
URL templateUrl = ApplicationSettings.loadFile(templateName);
if (templateUrl == null) {
String error = "Template file '" + templateName + "' not found";
throw new GFacException(error);
}
File template = new File(templateUrl.getPath());
TemplateEngine engine = new GStringTemplateEngine();
Writable make;
try {
make = engine.createTemplate(template).make(groovyMap);
} catch (Exception e) {
throw new GFacException("Error while generating script using groovy map", e);
}
return make.toString();
}
示例3: applySearchFormat
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
protected String applySearchFormat(String searchString, String format) {
if (StringUtils.isNotEmpty(format)) {
GStringTemplateEngine engine = new GStringTemplateEngine();
StringWriter writer = new StringWriter();
try {
engine.createTemplate(format).make(ParamsMap.of("searchString", searchString)).writeTo(writer);
return writer.toString();
} catch (ClassNotFoundException | IOException e) {
throw new IllegalStateException(e);
}
}
return searchString;
}
示例4: GroovyTemplateGenerator
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
public GroovyTemplateGenerator(final String template) {
try {
this.template = new GStringTemplateEngine().createTemplate(template);
} catch (ClassNotFoundException | IOException e) {
throw new BootException(e);
}
this.templateText = template;
}
示例5: parseCommands
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
static String parseCommands(String value, GroovyMap bindMap) {
TemplateEngine templateEngine = new GStringTemplateEngine();
try {
return templateEngine.createTemplate(value).make(bindMap).toString();
} catch (ClassNotFoundException | IOException e) {
throw new IllegalArgumentException("Error while parsing command " + value
+ " , Invalid command or incomplete bind map");
}
}
示例6: getConfig
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
public Map getConfig() {
GStringTemplateEngine engine = new GStringTemplateEngine();
String yaml = null;
try {
yaml = engine.createTemplate(config).make(new MissingPropForwardingMap(envVars)).toString();
} catch (Exception e) {
throw new RuntimeException(e);
}
return (Map) new Yaml().load(yaml);
}
示例7: template
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
public static String template(String name, Map<String, ?> model)
throws IOException, CompilationFailedException, ClassNotFoundException {
return template(new GStringTemplateEngine(), name, model);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:GroovyTemplate.java
示例8: groovyTemplateEngine
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
@Bean
public TemplateEngine groovyTemplateEngine() {
return new GStringTemplateEngine();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:SpringBootHypermediaApplication.java
示例9: initialize
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
@Override
public void initialize(VisitorContext context, Object rootNode) {
this.context = context;
engine = new GStringTemplateEngine(context.getClassLoader());
super.initialize(context, rootNode);
}
示例10: GroovyTemplateTestResource
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
public GroovyTemplateTestResource(TestResource<String> template, Map<String, String> variables) {
this(new GStringTemplateEngine(), template, variables);
}
示例11: groovy
import groovy.text.GStringTemplateEngine; //导入依赖的package包/类
/**
* A way of paramaterizing resources so that values are updated according to Groovy GStrings
*
* @param template A template of the string resource containing GString variables for substitution
* @param dataSource A list of name=value pairs that will be used for var substitution. Each entry in the
* list will result in another resource being returned
*/
default GroovyTemplateTestResource[] groovy(TestResource<String> template, List<Map<String, String>> dataSource) {
return groovy(template, dataSource, GStringTemplateEngine.class);
}