final String ownerTemplate = templateCacheKey.getOwnerTemplate(); if (ownerTemplate != null) { if (templateCacheKey.getTemplate().equals(template)) { keysToBeRemoved.add(templateCacheKey);
public TemplateCacheKey( final String ownerTemplate, final String template, final Set<String> templateSelectors, final int lineOffset, final int colOffset, final TemplateMode templateMode, final Map<String,Object> templateResolutionAttributes) { // NOTE we are assuming that templateSelectors is either null or a non-empty, naturally-ordered set. Also, // we are also assuming that templateResolutionAttributes is either null or non-empty. Also, BOTH // should be unmodifiable. This should have been sorted out at the TemplateSpec constructor. super(); // ownerTemplate will be null if this template is standalone (not something we are processing from inside another one like e.g. an inlining) Validate.notNull(template, "Template cannot be null"); // templateSelectors can be null if we are selecting the entire template // templateMode can be null if this template is standalone (no owner template) AND we are forcing a specific template mode for its processing // templateResolutionAttributes this.ownerTemplate = ownerTemplate; this.template = template; this.templateSelectors = templateSelectors; this.lineOffset = lineOffset; this.colOffset = colOffset; this.templateMode = templateMode; this.templateResolutionAttributes = templateResolutionAttributes; // This being a cache key, its equals and hashCode methods will potentially execute many // times, so this could help performance this.h = computeHashCode(); }
private Object prefix(final K key) { final String testName = TestExecutor.getThreadTestName(); if (key instanceof String) { return testName + "_" + key; } if (key instanceof TemplateCacheKey) { final TemplateCacheKey cacheKey = (TemplateCacheKey)key; return new TemplateCacheKey( cacheKey.getOwnerTemplate(), testName + "_" + cacheKey.getTemplate(), cacheKey.getTemplateSelectors(), cacheKey.getLineOffset(), cacheKey.getColOffset(), cacheKey.getTemplateMode(), cacheKey.getTemplateResolutionAttributes()); } if (key instanceof ExpressionCacheKey) { final ExpressionCacheKey cacheKey = (ExpressionCacheKey)key; return new ExpressionCacheKey(testName + "_" + cacheKey.getType(), cacheKey.getExpression0(), cacheKey.getExpression1()); } return key; }
new TemplateCacheKey( ownerTemplate, template, cleanTemplateSelectors,
private Object prefix(final K key) { final String testName = TestExecutor.getThreadTestName(); if (key instanceof String) { return testName + "_" + key; } if (key instanceof TemplateCacheKey) { final TemplateCacheKey cacheKey = (TemplateCacheKey)key; return new TemplateCacheKey( cacheKey.getOwnerTemplate(), testName + "_" + cacheKey.getTemplate(), cacheKey.getTemplateSelectors(), cacheKey.getLineOffset(), cacheKey.getColOffset(), cacheKey.getTemplateMode(), cacheKey.getTemplateResolutionAttributes()); } if (key instanceof ExpressionCacheKey) { final ExpressionCacheKey cacheKey = (ExpressionCacheKey)key; return new ExpressionCacheKey(testName + "_" + cacheKey.getType(), cacheKey.getExpression0(), cacheKey.getExpression1()); } return key; }
new TemplateCacheKey( ownerTemplate, template, null,