Class ModelExtractors
- java.lang.Object
-
- org.jbake.template.ModelExtractors
-
public class ModelExtractors extends java.lang.ObjectA 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
ModelExtractorand 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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(java.lang.Object key)<Type> TypeextractAndTransform(ContentStore db, java.lang.String key, java.util.Map map, TemplateEngineAdapter<Type> adapter)static ModelExtractorsgetInstance()java.util.Set<java.lang.String>keySet()voidregisterEngine(java.lang.String key, ModelExtractor extractor)voidregisterExtractorsForCustomTypes(java.lang.String docType)voidreset()
-
-
-
Method Detail
-
getInstance
public static ModelExtractors getInstance()
-
reset
public void reset()
-
registerEngine
public void registerEngine(java.lang.String key, ModelExtractor extractor)
-
extractAndTransform
public <Type> Type extractAndTransform(ContentStore db, java.lang.String key, java.util.Map map, TemplateEngineAdapter<Type> adapter) throws NoModelExtractorException
- Throws:
NoModelExtractorException
-
containsKey
public boolean containsKey(java.lang.Object key)
- Parameters:
key- A key aModelExtractoris registered with- Returns:
- true if key is registered
- See Also:
Map.containsKey(java.lang.Object)
-
keySet
public java.util.Set<java.lang.String> keySet()
- Returns:
- A @
Setof all known keys a @ModelExtractoris registered with - See Also:
Map.keySet()
-
registerExtractorsForCustomTypes
public void registerExtractorsForCustomTypes(java.lang.String docType)
-
-