Java Code Examples for com.github.mustachejava.reflect.MissingWrapper

The following examples show how to use com.github.mustachejava.reflect.MissingWrapper. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dcos-commons   Source File: TemplateUtils.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized Wrapper getWrapper(String name, List<Object> scopes) {
  Wrapper wrapper = super.getWrapper(name, scopes);
  // This should only do anything when the template param is e.g. "{{hello}}", not "{{#hello}}hi{{/hello}}".
  // The latter case implies an expectation that the value will sometimes be unset. We can determine the
  // situation based on the code type:
  // - "{{hello}}" = ValueCode <-- check for this case
  // - "{{#hello}}{{/hello}}" = IterableCode
  // - "{{^hello}}{{/hello}}" = NotIterableCode
  // - etc... "{{>partial}}", "{{!comment}}"
  if (code instanceof ValueCode && wrapper instanceof MissingWrapper) {
    missingValues.add(new MissingValue(name, tc.line()));
  }
  return wrapper;
}
 
Example 2
@Override
protected MissingWrapper createMissingWrapper(final String name, final List<Guard> guards) {
    throw new MissingParameterException(name);
}