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

com.farao_community.farao.ra_optimisation.json.RaoComputationParametersSerializer Maven / Gradle / Ivy

/*
 * Copyright (c) 2018, All partners of the iTesla project (http://www.itesla-project.eu/consortium)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.farao_community.farao.ra_optimisation.json;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import com.powsybl.commons.json.JsonUtil;
import com.powsybl.loadflow.json.JsonLoadFlowParameters;
import com.farao_community.farao.ra_optimisation.RaoComputationParameters;

import java.io.IOException;

/**
 * @author Mohamed Zelmat {@literal }
 */
public class RaoComputationParametersSerializer extends StdSerializer {

    RaoComputationParametersSerializer() {
        super(RaoComputationParameters.class);
    }

    @Override
    public void serialize(RaoComputationParameters parameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {

        jsonGenerator.writeStartObject();

        jsonGenerator.writeStringField("version", RaoComputationParameters.VERSION);

        jsonGenerator.writeFieldName("load-flow-parameters");
        JsonLoadFlowParameters.serialize(parameters.getLoadFlowParameters(), jsonGenerator, serializerProvider);

        JsonUtil.writeExtensions(parameters, jsonGenerator, serializerProvider, JsonRaoComputationParameters.getExtensionSerializers());

        jsonGenerator.writeEndObject();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy