com.github.mustachejava.Mustache.init()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中com.github.mustachejava.Mustache.init()方法的一些代码示例,展示了Mustache.init()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mustache.init()方法的具体详情如下:
包路径:com.github.mustachejava.Mustache
类名称:Mustache
方法名:init

Mustache.init介绍

[英]Initialize the mustache before executing. This is must be called at least once and is normally called already by the time you have a mustache instance.
[中]在执行之前初始化小胡子。它必须至少被调用一次,并且通常在您有一个Mustach实例时已经被调用。

代码示例

代码示例来源:origin: spullara/mustache.java

@Override
public Mustache compile(String name) {
 Mustache mustache = mustacheCache.computeIfAbsent(name, getMustacheCacheFunction());
 mustache.init();
 return mustache;
}

代码示例来源:origin: spullara/mustache.java

public Mustache compile(Reader reader, String file, String sm, String em) {
 Mustache compile = mc.compile(reader, file, sm, em);
 compile.init();
 partialCache.remove();
 return compile;
}

代码示例来源:origin: spullara/mustache.java

public Mustache getFragment(FragmentKey templateKey) {
 Mustache mustache = templateCache.computeIfAbsent(templateKey, getFragmentCacheFunction());
 mustache.init();
 return mustache;
}

代码示例来源:origin: spullara/mustache.java

/**
 * In order to handle recursion, we need a temporary thread local cache during compilation
 * that is ultimately thrown away after the top level partial is complete.
 *
 * @param s the name of the partial to compile
 * @return the compiled partial
 */
public Mustache compilePartial(String s) {
 final Map<String, Mustache> cache = partialCache.get();
 final Mustache cached = cache.get(s);
 if (cached != null) {
  // Our implementation supports this but I
  // don't think it makes sense in the interface
  if (cached instanceof DefaultMustache) {
   ((DefaultMustache)cached).setRecursive();
  }
  return cached;
 }
 try {
  final Mustache mustache = mc.compile(s);
  cache.put(s, mustache);
  mustache.init();
  return mustache;
 } finally {
  cache.remove(s);
 }
}

代码示例来源:origin: spullara/mustache.java

@Override
 protected Function<String, Mustache> getMustacheCacheFunction() {
  return (template) -> {
   Mustache compile = mp.compile(template);
   compile.init();
   return compile;
  };
 }
};

代码示例来源:origin: com.github.spullara.mustache.java/compiler

public Mustache getFragment(FragmentKey templateKey) {
 Mustache mustache = templateCache.computeIfAbsent(templateKey, getFragmentCacheFunction());
 mustache.init();
 return mustache;
}

代码示例来源:origin: com.github.spullara.mustache.java/compiler

public Mustache compile(Reader reader, String file, String sm, String em) {
 Mustache compile = mc.compile(reader, file, sm, em);
 compile.init();
 partialCache.remove();
 return compile;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mustache-compiler

public Mustache getFragment(FragmentKey templateKey) {
 Mustache mustache = templateCache.computeIfAbsent(templateKey, getFragmentCacheFunction());
 mustache.init();
 return mustache;
}

代码示例来源:origin: com.github.spullara.mustache.java/compiler

@Override
public Mustache compile(String name) {
 Mustache mustache = mustacheCache.computeIfAbsent(name, getMustacheCacheFunction());
 mustache.init();
 return mustache;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mustache-compiler

@Override
public Mustache compile(String name) {
 Mustache mustache = mustacheCache.computeIfAbsent(name, getMustacheCacheFunction());
 mustache.init();
 return mustache;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mustache-compiler

public Mustache compile(Reader reader, String file, String sm, String em) {
 Mustache compile = mc.compile(reader, file, sm, em);
 compile.init();
 partialCache.remove();
 return compile;
}

代码示例来源:origin: com.github.spullara.mustache.java/compiler

/**
 * In order to handle recursion, we need a temporary thread local cache during compilation
 * that is ultimately thrown away after the top level partial is complete.
 *
 * @param s the name of the partial to compile
 * @return the compiled partial
 */
public Mustache compilePartial(String s) {
 final Map<String, Mustache> cache = partialCache.get();
 final Mustache cached = cache.get(s);
 if (cached != null) {
  // Our implementation supports this but I
  // don't think it makes sense in the interface
  if (cached instanceof DefaultMustache) {
   ((DefaultMustache)cached).setRecursive();
  }
  return cached;
 }
 try {
  final Mustache mustache = mc.compile(s);
  cache.put(s, mustache);
  mustache.init();
  return mustache;
 } finally {
  cache.remove(s);
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mustache-compiler

/**
 * In order to handle recursion, we need a temporary thread local cache during compilation
 * that is ultimately thrown away after the top level partial is complete.
 *
 * @param s the name of the partial to compile
 * @return the compiled partial
 */
public Mustache compilePartial(String s) {
 final Map<String, Mustache> cache = partialCache.get();
 final Mustache cached = cache.get(s);
 if (cached != null) {
  // Our implementation supports this but I
  // don't think it makes sense in the interface
  if (cached instanceof DefaultMustache) {
   ((DefaultMustache)cached).setRecursive();
  }
  return cached;
 }
 try {
  final Mustache mustache = mc.compile(s);
  cache.put(s, mustache);
  mustache.init();
  return mustache;
 } finally {
  cache.remove(s);
 }
}

代码示例来源:origin: zcourts/higgs

public Mustache compile(String name) {
  if (config.cache_templates) {
    return super.compile(name);
  }
  try {
    Mustache mustache = mc.compile(name);
    mustache.init();
    return mustache;
  } catch (UncheckedExecutionException e) {
    throw handle(e);
  }
}

相关文章