{@inheritDoc}

@return {@link TemplateContentData} if exists and it is fresh, otherwise return null
768324
@Override
    public TemplateContentData get(String identifier) {
        Object lock = locksMap.get(identifier);
        if (lock != null) {
            synchronized (lock) {
                AccessOrderedTemplateContentData data = templateDataMap.get(identifier);
                if ((data != null) && templateOrderQueue.contains(data)) {
                    templateOrderQueue.remove(data);
                    if (isFresh(data)) {
                        TemplateContentData templateContentData = data.getTemplateContentData();
                        templateOrderQueue.offer(data);
                        return templateContentData;
                    }
                    templateDataMap.remove(identifier);
                    deductAndGet(data.getTemplateContentData().getTemplateContent().length);
                    LOGGER.warn(String.format("Template: %s is out of date, removing.", identifier));
                }
            }
        }
        return null;
    }
591287
protected function _getTemplate()
    {
        if (is_null($this->_template)) {
            foreach ($this->_map as $method => $className) {
                if ($this->_sql instanceof $className) {
                    $this->_template = $this->$method();
                    break;
                }
            }
        }
        return $this->_template;
    }
1114027
public function getTemplateContent(){

        $standardRpTemplateFolder = dirname(__FILE__).'/../data/qtiv2p1/rptemplates/';
        switch($this->uri){
            case self::MATCH_CORRECT:
                $returnValue = file_get_contents($standardRpTemplateFolder.'match_correct.xml');
                break;
            case self::MAP_RESPONSE:
                $returnValue = file_get_contents($standardRpTemplateFolder.'map_response.xml');
                break;
            case self::MAP_RESPONSE_POINT:
                $returnValue = file_get_contents($standardRpTemplateFolder.'map_response_point.xml');
                break;
            case self::NONE:
                $returnValue = '';
                break;
            default:
                throw new QtiModelException('unknown rp template');
        }
        return $returnValue;
    }
1289866
public String getContentId() {
        String[] values = getMimeHeader("Content-ID");
        if (values != null && values.length > 0)
            return values[0];
        return null;
    }
437338
public static Function<String, String> createStringTemplateSource(
        I_CmsFormatterBean formatter,
        Supplier<CmsXmlContent> contentSupplier) {

        return key -> {
            String result = null;
            if (formatter != null) {
                result = formatter.getAttributes().get(key);
            }
            if (result == null) {
                CmsXmlContent content = contentSupplier.get();
                if (content != null) {
                    result = content.getHandler().getParameter(key);
                }
            }
            return result;
        };
    }
802947
private String generateContent(String templateFile) {
		try {
			GStringTemplateEngine gStringEngine = new GStringTemplateEngine();
			URL url = loadTemplate(templateFolder + "/" + templateFile);
			if (url == null) {
				logWarn("NO TEMPLATE FOUND FOR " + templateFile);
			} else {
				logDebug("Loaded template: " + url.getPath());
			}
			if (url == null) return null;
			
			Template template = gStringEngine.createTemplate(url);
			return template.make(modelMap).toString();
		} catch (Exception e) {
			ps.println("### ERROR: Failed generate templatefile: " + templateFile);
			e.printStackTrace(ps);
			return null;
		}
	}
36307
function getTemplate(template) {
  var ret;

  store.roots.some(function(r) {
    var filepath = path.join(r, template);
    if (file.exists(filepath)) {
      ret = filepath;
      return true;
    }
  });

  return ret;
}
986190
@Override
    public String getTemplateURI(String controllerName, String templateName) {
        TupleStringKey key = new TupleStringKey(controllerName, templateName);
        String uri = templateURICache.get(key);
        if (uri == null) {
            uri = super.getTemplateURI(controllerName, templateName);
            String prevuri=templateURICache.putIfAbsent(key, uri);
            if (prevuri != null) {
                return prevuri;
            }
        }
        return uri;
    }
848087
@Override
    synchronized public void put(String identifier, TemplateContentData templateContentData) {
        if (!locksMap.containsKey(identifier)) {
            locksMap.put(identifier, new Object());
        }
        Object lock = locksMap.get(identifier);
        synchronized (lock) {
            int size = templateContentData.getTemplateContent().length;
            if (size > capacity) {
                LOGGER.warn(String.format("No caching for template with size: %s larger than total capacity: %s.", size, capacity));
                return;
            }
            if (templateDataMap.containsKey(identifier)) {
                LOGGER.info(String.format("Try to put the same template with identifier: %s into cache, removing duplicate entry in queue.", identifier));
                templateOrderQueue.remove(templateDataMap.get(identifier));
            }
            while (size + capacityCounter.get() > capacity) {
                AccessOrderedTemplateContentData eldest = templateOrderQueue.poll();
                TemplateContentData eldestTemplate = eldest.getTemplateContentData();
                templateDataMap.remove(eldestTemplate.getIdentifier());
                deductAndGet(eldestTemplate.getTemplateContent().length);
            }
            AccessOrderedTemplateContentData data = AccessOrderedTemplateContentData.builder()
                    .withTemplateContentData(templateContentData)
                    .build();
            templateOrderQueue.offer(data);
            templateDataMap.put(identifier, data);
            capacityCounter.addAndGet(size);
        }
    }
977242
public static TemplatedURLFormatter getTemplatedURLFormatter(ServletRequest servletRequest)
    {
        assert servletRequest != null : "The ServletRequest cannot be null.";

        if (servletRequest == null) {
            throw new IllegalArgumentException("The ServletRequest cannot be null.");
        }

        return (TemplatedURLFormatter) servletRequest.getAttribute(TEMPLATED_URL_FORMATTER_ATTR);
    }
69742
protected InputStream getTemplateAsStream(TestContext context) {
        Resource resource;
        if (templateResource != null) {
            resource = templateResource;
        } else {
            resource = FileUtils.getFileResource(template, context);
        }

        String templateYml;
        try {
            templateYml = context.replaceDynamicContentInString(FileUtils.readToString(resource));
        } catch (IOException e) {
            throw new CitrusRuntimeException("Failed to read template resource", e);
        }
        return new ByteArrayInputStream(templateYml.getBytes());
    }
114492
function(template, data){

    if (!template) {
      var error = new Error("Cannot render the template since it's false, null or undefined.");
      error.name = "TemplateNotFoundError";
      throw error;
    }

    var templateFunc;
    if (typeof template === "function"){
      templateFunc = template;
    } else {
      templateFunc = Marionette.TemplateCache.get(template);
    }

    return templateFunc(data);
  }
1267502
public static function Render($template=null, $data=null)
    {
        if ($template && $data) {
            return self::$renderer->render($template, $data);
        } else {
            self::$data = self::getData();
            self::$templates[] = "index";
            self::loadTemplate(self::$templates);
        }
    }
1213359
public static String get(final String templateName, final Map<String, Object> data) {
        StringWriter writer = new StringWriter();
        write(templateName, data, writer);
        return writer.toString();
    }
555414
protected function getMetadata($templateFileContent)
    {
        $regex                = '/\@MajoraGenerator\((.+)\)/';
        $templateFileMetadata = array('force_generation' => false);
        if (!preg_match_all($regex, $templateFileContent, $matches, PREG_SET_ORDER)) {
            return $templateFileMetadata;
        }
        foreach ($matches as $match) {
            if (null === $metadata = json_decode($match[1], true)) {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid annotation json data, error %s : %s',
                    json_last_error(),
                    json_last_error_msg()
                ));
            }

            $templateFileMetadata =  array_replace_recursive(
                $templateFileMetadata,
                $metadata
            );
        }

        return $templateFileMetadata;
    }
1101748
private ThymeLeafTemplateImplementation getTemplateByURL(URL url) {
        Collection<ThymeLeafTemplateImplementation> list = registrations.keySet();
        for (ThymeLeafTemplateImplementation template : list) {
            if (template.getURL().sameFile(url)) {
                return template;
            }
        }
        return null;
    }
921293
public Template getTemplate(final String name) throws ResourceNotFoundException {
        final Template template = this.cachedTemplates.get(name);
        if (template != null) {
            return template;
        }
        return createTemplateIfAbsent(name);
    }