@Override public void init(Configuration configuration) { isEnabled = configuration.getBooleanPropertyValue(ENABLED_KEY); }
/** * * @param configuration * @return <code>true</code> if it's possible to cache the template in a * segment, i.e. if the cache is enabled, no expiration timeout is * set and debug mode is not enabled, <code>false</code> otherwise */ static boolean isTemplateCachingAllowed(Configuration configuration) { return !configuration.getBooleanPropertyValue(DEBUG_MODE) && configuration.getBooleanPropertyValue(TEMPLATE_CACHE_ENABLED) && configuration.getLongPropertyValue( TEMPLATE_CACHE_EXPIRATION_TIMEOUT) <= 0; }
@Override protected void init() { if (!configuration.getBooleanPropertyValue( EngineConfigurationKey.SKIP_VALUE_ESCAPING)) { textSupport = configuration.getTextSupport(); } }
protected boolean isHandlebarsSupportEnabled() { return getEngineConfiguration().getBooleanPropertyValue( EngineConfigurationKey.HANDLEBARS_SUPPORT_ENABLED); }
@Override public void startTemplate(String name, Delimiters delimiters, MustacheEngine engine) { this.delimiters = delimiters; this.engine = engine; this.templateName = name; containerStack.addFirst(new RootSegmentBase()); skipValueEscaping = engine.getConfiguration().getBooleanPropertyValue( EngineConfigurationKey.SKIP_VALUE_ESCAPING); handlebarsSupportEnabled = engine.getConfiguration() .getBooleanPropertyValue( EngineConfigurationKey.HANDLEBARS_SUPPORT_ENABLED); start = System.currentTimeMillis(); LOGGER.debug("Start compilation of {}", new Object[] { name }); }
/** * * @param text * @param configuration */ ValueProvider(String text, Configuration configuration) { this.key = text; ArrayList<String> parts = new ArrayList<>(); for (Iterator<String> iterator = configuration.getKeySplitter() .split(text); iterator.hasNext();) { parts.add(iterator.next()); } this.keyParts = parts.toArray(new String[parts.size()]); if (configuration.getBooleanPropertyValue( EngineConfigurationKey.RESOLVER_HINTS_ENABLED)) { this.hint = new AtomicReference<>(); } else { this.hint = null; } }
public AbstractSectionSegment(String name, Origin origin, List<Segment> segments) { super(name, origin, segments); if (getEngineConfiguration().getBooleanPropertyValue( EngineConfigurationKey.CACHE_SECTION_LITERAL_BLOCK)) { this.cachedContentLiteralBlock = getContentLiteralBlock(); } else { this.cachedContentLiteralBlock = null; } }
@Override public void init() { long memberCacheMaxSize = configuration .getLongPropertyValue(MEMBER_CACHE_MAX_SIZE_KEY); LOGGER.debug("Initialized [memberCacheMaxSize: {}]", memberCacheMaxSize); if (memberCacheMaxSize > 0) { memberCache = configuration.getComputingCacheFactory().create( COMPUTING_CACHE_CONSUMER_ID, ReflectionResolver::findWrapper, null, memberCacheMaxSize, null); } hintFallbackEnabled = configuration .getBooleanPropertyValue(HINT_FALLBACK_ENABLED_KEY); }
.getBooleanPropertyValue(EngineConfigurationKey.DEBUG_MODE)) { templateCache = null; sourceCache = null; "Attention! Debug mode enabled: template cache disabled, additional logging enabled"); } else { if (configuration.getBooleanPropertyValue( EngineConfigurationKey.TEMPLATE_CACHE_ENABLED)) { templateCache = buildTemplateCache(); sourceCache = configuration.getBooleanPropertyValue( EngineConfigurationKey.TEMPLATE_CACHE_USED_FOR_SOURCE) ? buildSourceCache() : null; if (configuration.getBooleanPropertyValue( EngineConfigurationKey.PRECOMPILE_ALL_TEMPLATES)) { precompileTemplates();
@Override public void init() { if (!configuration.getBooleanPropertyValue(ENABLED_KEY)) { return; } super.init(); setMatchingNames(configuration.getStringPropertyValue(MATCH_NAME_KEY)); prettyTimeCache = configuration.getComputingCacheFactory().create( COMPUTING_CACHE_CONSUMER_ID, factory::createPrettyTime, null, 10L, null); LOGGER.info("Initialized [matchingName: {}]", matchingName(0)); }
@Override public void endTemplate() { RootSegmentBase rootSegmentBase = validate(); // Post processing if (engine.getConfiguration() .getBooleanPropertyValue(REMOVE_STANDALONE_LINES)) { SegmentBases.removeStandaloneLines(rootSegmentBase); } if (engine.getConfiguration() .getBooleanPropertyValue(REMOVE_UNNECESSARY_SEGMENTS)) { SegmentBases.removeUnnecessarySegments(rootSegmentBase); } if (engine.getConfiguration() .getBooleanPropertyValue(REUSE_LINE_SEPARATOR_SEGMENTS)) { SegmentBases.reuseLineSeparatorSegments(rootSegmentBase); } template = new Template(engine.getConfiguration() .getIdentifierGenerator().generate(Mustache.class), templateName, engine, nestedTemplates); template.initRootSegment(rootSegmentBase.asSegment(template)); for (Template nested : nestedTemplates) { nested.initParent(template); } LOGGER.debug("Compilation of {} finished [time: {} ms, segments: {}]", templateName, System.currentTimeMillis() - start, template.getRootSegment().getSegmentsSize(true)); nestedTemplates.clear(); containerStack.clear(); }
private void nestedTemplate(ParsedTag tag) { if (engine.getConfiguration().getBooleanPropertyValue( EngineConfigurationKey.NESTED_TEMPLATE_SUPPORT_ENABLED)) {