Class ModelExtractors


  • 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.

    • Method Detail

      • reset

        public void reset()
      • registerEngine

        public void registerEngine​(java.lang.String key,
                                   ModelExtractor extractor)
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Parameters:
        key - A key a ModelExtractor is 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 @Set of all known keys a @ModelExtractor is registered with
        See Also:
        Map.keySet()
      • registerExtractorsForCustomTypes

        public void registerExtractorsForCustomTypes​(java.lang.String docType)