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

org.oewntk.ser.out.CoreModelConsumer.kt Maven / Gradle / Ivy

/*
 * Copyright (c) 2021-2024. Bernard Bou.
 */
package org.oewntk.ser.out

import org.oewntk.model.CoreModel
import org.oewntk.model.Serialize.serializeCoreModel
import java.io.File
import java.io.IOException
import java.util.function.Consumer

/**
 * Main class that serializes the core model.
 *
 * @property file output file
 * @author Bernard Bou
 */
class CoreModelConsumer(private val file: File) : Consumer {

    override fun accept(model: CoreModel) {
        Tracing.psInfo.printf("[CoreModel] %s%n", model.source)
        try {
            serializeCoreModel(model, file)
        } catch (e: IOException) {
            e.printStackTrace(Tracing.psErr)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy