All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.varmateo.yawg.core.DefaultSiteBakerModule Maven / Gradle / Ivy

/**************************************************************************
 *
 * Copyright (c) 2019 Yawg project contributors.
 *
 **************************************************************************/

package com.varmateo.yawg.core;

import java.nio.file.Path;

import io.vavr.Lazy;
import io.vavr.control.Option;

import com.varmateo.yawg.api.SiteBaker;


/**
 *
 */
/* default */ final class DefaultSiteBakerModule {


    private final Option _templatesDir;

    private final Lazy _defaultSiteBakerModule =
            Lazy.of(this::createCoreSiteBakerModule);

    private final Lazy _defaultExtensionsModule =
            Lazy.of(this::createDefaultExtensionsModule);


    private DefaultSiteBakerModule(final Option templatesDir) {

        _templatesDir = templatesDir;
    }


    /**
     *
     */
    public static DefaultSiteBakerModule create(final Option templatesDir) {

        return new DefaultSiteBakerModule(templatesDir);
    }


    /**
     *
     */
    public SiteBaker siteBaker() {

        return _defaultSiteBakerModule.get().siteBaker();
    }


    private CoreSiteBakerModule createCoreSiteBakerModule() {

        return CoreSiteBakerModule.create(
                () -> _defaultExtensionsModule.get().pageBakers(),
                () -> _defaultExtensionsModule.get().templateServices(),
                () -> _defaultExtensionsModule.get().dirBakeListeners());
    }


    private DefaultExtensionsModule createDefaultExtensionsModule() {

        return DefaultExtensionsModule.create(_templatesDir);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy