Refine search
public StandardDOMEventAttributeTagProcessor(final String dialectPrefix, final String attrName) { super(TemplateMode.HTML, dialectPrefix, null, false, attrName, true, PRECEDENCE, false); Validate.notNull(attrName, "Complete name of target attribute cannot be null"); this.targetAttrCompleteName = attrName; }
public static void containsNoEmpties(final Iterable<String> collection, final String message) { for (final String object : collection) { notEmpty(object, message); } }
TemplateModel( final IEngineConfiguration configuration, final TemplateData templateData, final IEngineTemplateEvent[] queue) { super(); Validate.notNull(configuration, "Engine Configuration cannot be null"); Validate.notNull(templateData, "Template Resolution cannot be null"); Validate.notNull(queue, "Event queue cannot be null"); Validate.isTrue(queue.length >= 2, "At least TemplateStart/TemplateEnd events must be added to a TemplateModel"); Validate.isTrue(queue[0] == TemplateStart.TEMPLATE_START_INSTANCE, "First event in queue is not TemplateStart"); Validate.isTrue(queue[queue.length - 1] == TemplateEnd.TEMPLATE_END_INSTANCE, "Last event in queue is not TemplateEnd"); this.configuration = configuration; this.templateData = templateData; this.queue = queue; }
public ExpressionSequence(final List<? extends IStandardExpression> expressions) { super(); Validate.notNull(expressions, "Expression list cannot be null"); Validate.containsNoNulls(expressions, "Expression list cannot contain any nulls"); this.expressions = Collections.unmodifiableList(expressions); }
public DecoupledTemplateLogicBuilderMarkupHandler(final String templateName, final TemplateMode templateMode) { super(); Validate.notEmpty(templateName, "Template name cannot be null or empty"); Validate.notNull(templateMode, "Template mode cannot be null"); this.templateName = templateName; this.templateMode = templateMode; this.decoupledTemplateLogic = new DecoupledTemplateLogic(); }
private void execute(final ITestable testable, final TestExecutionContext context) { Validate.notNull(testable, "Testable cannot be null"); Validate.notNull(context, "Test execution context cannot be null"); final TestEngineTemplateResolver templateResolver = new TestEngineTemplateResolver(); final TestEngineMessageResolver messageResolver = new TestEngineMessageResolver(); final TestCacheManager cacheManager = new TestCacheManager(); final TemplateEngine templateEngine = new TemplateEngine(); templateEngine.setTemplateResolver(templateResolver); templateEngine.setMessageResolver(messageResolver); templateEngine.setDialects(new HashSet<IDialect>(this.dialects)); templateEngine.setCacheManager(cacheManager); context.setTemplateEngine(templateEngine); this.reporter.executionStart(context.getExecutionId()); final TestExecutionResult result = executeTestable(testable, context); this.reporter.executionEnd( context.getExecutionId(), result.getTotalTestsOk(), result.getTotalTestsExecuted(), result.getTotalTimeNanos()); }
Validate.notNull(templateResolvers, "Template Resolver set cannot be null"); Validate.isTrue(templateResolvers.size() > 0, "Template Resolver set cannot be empty"); Validate.containsNoNulls(templateResolvers, "Template Resolver set cannot contain any nulls"); Validate.notNull(messageResolvers, "Message Resolver set cannot be null"); Validate.notNull(dialectConfigurations, "Dialect configuration set cannot be null"); Validate.notNull(engineContextFactory, "Engine Context Factory cannot be null"); Validate.notNull(decoupledTemplateLogicResolver, "Decoupled Template Logic Resolver cannot be null");
/** * <p> * Adds a new template resolver to the current set. * </p> * * @param templateResolver the new template resolver. */ public void addTemplateResolver(final ITemplateResolver templateResolver) { Validate.notNull(templateResolver, "Template Resolver cannot be null"); checkNotInitialized(); this.templateResolvers.add(templateResolver); }
/** * <p> * Sets an additional set of dialects for this template engine, all of them using * their default prefixes. * </p> * <p> * This operation can only be executed before processing templates for the first * time. Once a template is processed, the template engine is considered to be * <i>initialized</i>, and from then on any attempt to change its configuration * will result in an exception. * </p> * * @param additionalDialects the new set of {@link IDialect} objects to be used. * * @since 2.0.9 * */ public void setAdditionalDialects(final Set<IDialect> additionalDialects) { Validate.notNull(additionalDialects, "Dialect set cannot be null"); checkNotInitialized(); for (final IDialect dialect : additionalDialects) { addDialect(dialect); } }
public final IThrottledTemplateProcessor processThrottled(final TemplateSpec templateSpec, final IContext context) { initialize(); try { Validate.notNull(templateSpec, "Template Specification cannot be null"); Validate.notNull(context, "Context cannot be null"); new Object[]{TemplateEngine.threadIndex(), templateSpec, context.getLocale()}); new Object[]{TemplateEngine.threadIndex(), templateSpec, context.getLocale()});
final IMarkupParser parser) throws IOException, ParseException { Validate.notNull(configuration, "Engine Configuration cannot be null"); Validate.notNull(template, "Template cannot be null"); Validate.notNull(resource, "Template Resource cannot be null"); Validate.notNull(templateMode, "Template Mode cannot be null"); "[THYMELEAF][{}] Decoupled logic for template \"{}\" could not be resolved as relative resource \"{}\". " + "This does not need to be an error, as templates may lack a corresponding decoupled logic file.", new Object[] {TemplateEngine.threadIndex(), LoggingUtils.loggifyTemplateName(template), decoupledResource.getDescription()}); logger.trace( "[THYMELEAF][{}] Decoupled logic for template \"{}\" has been resolved as relative resource \"{}\"", new Object[] {TemplateEngine.threadIndex(), LoggingUtils.loggifyTemplateName(template), decoupledResource.getDescription()});
/** * <p> * Sets the entire set of template resolvers. * </p> * * @param templateResolvers the new template resolvers. */ public void setTemplateResolvers(final Set<ITemplateResolver> templateResolvers) { Validate.notNull(templateResolvers, "Template Resolver set cannot be null"); checkNotInitialized(); this.templateResolvers.clear(); for (final ITemplateResolver templateResolver : templateResolvers) { addTemplateResolver(templateResolver); } }
Validate.notNull(template, "Template cannot be null"); Validate.isTrue(templateMode == null || outputContentType == null, "If template mode or output content type are specified, the other one cannot"); Validate.containsNoEmpties( templateSelectors, "If specified, the Template Selector set cannot contain any nulls or empties"); if (templateSelectors.size() == 1) {
/** * <p> * Sets the message resolvers to be used by this template engine. * </p> * <p> * This operation can only be executed before processing templates for the first * time. Once a template is processed, the template engine is considered to be * <i>initialized</i>, and from then on any attempt to change its configuration * will result in an exception. * </p> * * @param messageResolvers the Set of template resolvers. */ public void setMessageResolvers(final Set<IMessageResolver> messageResolvers) { Validate.notNull(messageResolvers, "Message Resolver set cannot be null"); checkNotInitialized(); this.messageResolvers.clear(); for (final IMessageResolver messageResolver : messageResolvers) { addMessageResolver(messageResolver); } }
public StandardCache(final String name, final boolean useSoftReferences, final int initialCapacity, final int maxSize, final ICacheEntryValidityChecker<? super K, ? super V> entryValidityChecker, final Logger logger, final boolean enableCounters) { super(); Validate.notEmpty(name, "Name cannot be null or empty"); Validate.isTrue(initialCapacity > 0, "Initial capacity must be > 0"); Validate.isTrue(maxSize != 0, "Cache max size must be either -1 (no limit) or > 0"); this.name = name; this.useSoftReferences = useSoftReferences; this.maxSize = maxSize; this.entryValidityChecker = entryValidityChecker; this.logger = logger; this.traceExecution = (logger != null && logger.isTraceEnabled()); this.enableCounters = (this.traceExecution || enableCounters); this.dataContainer = new CacheDataContainer<K,V>(this.name, initialCapacity, maxSize, this.traceExecution, this.logger); this.getCount = new AtomicLong(0); this.putCount = new AtomicLong(0); this.hitCount = new AtomicLong(0); this.missCount = new AtomicLong(0); if (this.logger != null) { if (this.maxSize < 0) { this.logger.trace("[THYMELEAF][CACHE_INITIALIZE] Initializing cache {}. Soft references {}.", this.name, (this.useSoftReferences? "are used" : "not used")); } else { this.logger.trace("[THYMELEAF][CACHE_INITIALIZE] Initializing cache {}. Max size: {}. Soft references {}.", new Object[] {this.name, Integer.valueOf(this.maxSize), (this.useSoftReferences? "are used" : "not used")}); } } }
/** * <p> * Clears the entry in the Template Cache for the specified * template, if it is currently cached. * </p> * <p> * If this method is called before the TemplateEngine has been initialized, * it causes its initialization. * </p> * * @param templateName the name of the template to be cleared from cache. */ public void clearTemplateCacheFor(final String templateName) { Validate.notNull(templateName, "Template name cannot be null"); if (!this.initialized) { initialize(); } this.configuration.getTemplateManager().clearCachesFor(templateName); }
/** * <p> * Sets the link builders to be used by this template engine. * </p> * <p> * This operation can only be executed before processing templates for the first * time. Once a template is processed, the template engine is considered to be * <i>initialized</i>, and from then on any attempt to change its configuration * will result in an exception. * </p> * * @param linkBuilders the Set of link builders. */ public void setLinkBuilders(final Set<ILinkBuilder> linkBuilders) { Validate.notNull(linkBuilders, "Link Builder set cannot be null"); checkNotInitialized(); this.linkBuilders.clear(); for (final ILinkBuilder linkBuilder : linkBuilders) { addLinkBuilder(linkBuilder); } }
StandaloneElementTag( final TemplateMode templateMode, final ElementDefinition elementDefinition, final String elementCompleteName, final Attributes attributes, final boolean synthetic, final boolean minimized, final String templateName, final int line, final int col) { super(templateMode, elementDefinition, elementCompleteName, attributes, synthetic, templateName, line, col); Validate.isTrue(minimized || templateMode == TemplateMode.HTML, "Not-minimized standalone elements are only allowed in HTML template mode (is " + templateMode + ")"); this.minimized = minimized; }
Validate.containsNoNulls(this.processors, "Processor set can contain no nulls (dialect: " + this.dialect.getClass().getName() + ")"); Validate.containsNoNulls(this.docTypeTranslations, "Document Type translations can contain no nulls"); Validate.containsNoNulls(this.docTypeResolutionEntries, "Document Type resolution entries can contain no nulls");
AssignationSequence(final List<Assignation> assignations) { super(); Validate.notNull(assignations, "Assignation list cannot be null"); Validate.containsNoNulls(assignations, "Assignation list cannot contain any nulls"); this.assignations = Collections.unmodifiableList(assignations); }