public class ModelExtractors extends 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.
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(Object key) |
<Type> Type |
extractAndTransform(ContentStore db,
String key,
Map map,
TemplateEngineAdapter<Type> adapter) |
static ModelExtractors |
getInstance() |
Set<String> |
keySet() |
void |
registerEngine(String key,
ModelExtractor extractor) |
void |
registerExtractorsForCustomTypes(String docType) |
public static ModelExtractors getInstance()
public void registerEngine(String key, ModelExtractor extractor)
public <Type> Type extractAndTransform(ContentStore db, String key, Map map, TemplateEngineAdapter<Type> adapter) throws NoModelExtractorException
NoModelExtractorExceptionpublic boolean containsKey(Object key)
key - Map.containsKey(java.lang.Object)public Set<String> keySet()
Map.keySet()public void registerExtractorsForCustomTypes(String docType)
Copyright © 2016. All rights reserved.