public class ModelExtractors
extends java.lang.Object
A singleton class giving access to model extractors. Model extractors are loaded based on classpath. New rendering may be registered either at runtime (not recommanded) or by putting a descriptor file on classpath (recommanded).
The descriptor file must be found in META-INF directory and named org.jbake.template.ModelExtractors.properties. The format of the file is easy:
org.jbake.template.model.AllPosts=all_posts
org.jbake.template.model.AllContent=all_content
where the key is the class of the extractor (must implement ModelExtractor and the value is the key
by which values are to be accessed in model.
This class loads the engines only if they are found on classpath. If not, the engine is not registered. This allows JBake to support multiple rendering engines without the explicit need to have them on classpath. This is a better fit for embedding.
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(java.lang.Object key) |
<Type> Type |
extractAndTransform(ContentStore db,
java.lang.String key,
java.util.Map map,
TemplateEngineAdapter<Type> adapter) |
static ModelExtractors |
getInstance() |
java.util.Set<java.lang.String> |
keySet() |
void |
registerEngine(java.lang.String key,
ModelExtractor extractor) |
void |
registerExtractorsForCustomTypes(java.lang.String docType) |
void |
reset() |
public static ModelExtractors getInstance()
public void reset()
public void registerEngine(java.lang.String key,
ModelExtractor extractor)
public <Type> Type extractAndTransform(ContentStore db, java.lang.String key, java.util.Map map, TemplateEngineAdapter<Type> adapter) throws NoModelExtractorException
NoModelExtractorExceptionpublic boolean containsKey(java.lang.Object key)
key - A key a ModelExtractor is registered withMap.containsKey(java.lang.Object)public java.util.Set<java.lang.String> keySet()
Set of all known keys a @ModelExtractor is registered withMap.keySet()public void registerExtractorsForCustomTypes(java.lang.String docType)