/** * Don't use the ServiceLoader mechanism to load configuration extensions * (i.e. the default resolvers are not added automatically). * * @see ConfigurationExtension */ public MustacheEngineBuilder omitServiceLoaderConfigurationExtensions() { checkNotBuilt(); this.omitServiceLoaderConfigurationExtensions = true; return this; }
/** * Add a value converter. * * @param converter * @return self */ public MustacheEngineBuilder addValueConverter(ValueConverter converter) { checkArgumentNotNull(converter); checkNotBuilt(); this.valueConverters.add(converter); return this; }
/** * Sets a locale support instance. * * @param localeSupport * @return self */ public MustacheEngineBuilder setLocaleSupport(LocaleSupport localeSupport) { checkArgumentNotNull(localeSupport); checkNotBuilt(); this.localeSupport = localeSupport; return this; }
/** * Adds a template locator. * * @param locator * @return self */ public MustacheEngineBuilder addTemplateLocator(TemplateLocator locator) { checkArgumentNotNull(locator); checkNotBuilt(); this.templateLocators.add(locator); return this; }
/** * * @param keySplitter * @return self */ public MustacheEngineBuilder setKeySplitter(KeySplitter keySplitter) { checkArgumentNotNull(keySplitter); checkNotBuilt(); this.keySplitter = keySplitter; return this; }
/** * Add a context converter. * * @param converter * @return self */ public MustacheEngineBuilder addContextConverter(ContextConverter converter) { checkArgumentNotNull(converter); checkNotBuilt(); this.contextConverters.add(converter); return this; }
/** * * @param missingValueHandler * @return self */ public MustacheEngineBuilder setMissingValueHandler( MissingValueHandler missingValueHandler) { checkArgumentNotNull(missingValueHandler); checkNotBuilt(); this.missingValueHandler = missingValueHandler; return this; }
/** * Sets a configuration property. * * @param key * @param value * @return self */ public MustacheEngineBuilder setProperty(String key, Object value) { checkArgumentsNotNull(key, value); checkNotBuilt(); this.properties.put(key, value); return this; }
/** * Adds a value resolver. * * @param resolver * @return self */ public MustacheEngineBuilder addResolver(Resolver resolver) { checkArgumentNotNull(resolver); checkNotBuilt(); this.resolvers.add(resolver); return this; }
/** * Sets a text support instance. * * @param textSupport * @return self */ public MustacheEngineBuilder setTextSupport(TextSupport textSupport) { checkArgumentNotNull(textSupport); checkNotBuilt(); this.textSupport = textSupport; return this; }
/** * Set the custom {@link ComputingCacheFactory}. * * @param cacheFactory * @return self */ public MustacheEngineBuilder setComputingCacheFactory( ComputingCacheFactory cacheFactory) { checkArgumentNotNull(cacheFactory); checkNotBuilt(); this.computingCacheFactory = cacheFactory; return this; }
/** * Set the custom {@link IdentifierGenerator}. * * @param identifierGenerator * @return self */ public MustacheEngineBuilder setIdentifierGenerator( IdentifierGenerator identifierGenerator) { checkArgumentNotNull(identifierGenerator); checkNotBuilt(); this.identifierGenerator = identifierGenerator; return this; }
/** * Set the {@link ExecutorService} to be used for async tasks. * * @param executorService * @return self */ public MustacheEngineBuilder setExecutorService( ExecutorService executorService) { checkArgumentNotNull(executorService); checkNotBuilt(); this.executorService = executorService; return this; }
/** * Set the custom {@link LiteralSupport}. * * @param literalSupport * @return self */ public MustacheEngineBuilder setLiteralSupport( LiteralSupport literalSupport) { checkArgumentNotNull(literalSupport); checkNotBuilt(); this.literalSupport = literalSupport; return this; }
/** * Set the {@link ClassLoader} used to load {@link ConfigurationExtension}s. * * @param configurationExtensionClassLoader * @return self */ public MustacheEngineBuilder setConfigurationExtensionClassLoader( ClassLoader configurationExtensionClassLoader) { checkArgumentNotNull(configurationExtensionClassLoader); checkNotBuilt(); this.configurationExtensionClassLoader = configurationExtensionClassLoader; return this; }
/** * Adds a {@link Mustache} listener. Manually added listeners are always * registered before listeners added via configuration extensions. * * @param listener * @return self */ public MustacheEngineBuilder addMustacheListener( MustacheListener listener) { checkArgumentNotNull(listener); checkNotBuilt(); this.mustacheListeners.add(listener); return this; }
/** * Callback is useful to configure a component instantiated before the * engine is built. * * @param callback * @return self */ public MustacheEngineBuilder registerCallback( EngineBuiltCallback callback) { checkArgumentNotNull(callback); checkNotBuilt(); this.engineReadyCallbacks.add(callback); return this; }
/** * Adds a value (e.g. Lambda) that is available during execution of all * templates. * * Global values have to be thread-safe. * * @param value * @param name * @return self */ public MustacheEngineBuilder addGlobalData(String name, Object value) { checkArgumentsNotNull(name, value); checkNotBuilt(); this.globalData.put(name, value); return this; }
/** * Each helper must be registered with a unique name. If there is a helper * registered with the same name and the param <code>overwrite</code> is * <code>true</code> the previous instance is replaced, otherwise an * {@link IllegalArgumentException} is thrown. * * @param helpers * @param overwrite * @return */ public MustacheEngineBuilder registerHelpers(Map<String, Helper> helpers, boolean overwrite) { checkArgumentNotNull(helpers); checkNotBuilt(); for (Entry<String, Helper> entry : helpers.entrySet()) { registerHelper(entry.getKey(), entry.getValue(), overwrite); } return this; }
/** * Sets a configuration property. * * @param configurationKey * @param value * @param <T> * The type of configuration key * @return self */ public <T extends ConfigurationKey> MustacheEngineBuilder setProperty( T configurationKey, Object value) { checkArgumentsNotNull(configurationKey, value); checkNotBuilt(); setProperty(configurationKey.get(), value); return this; }