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

org.nuiton.eugene.FriendTemplatesGenerator Maven / Gradle / Ivy

package org.nuiton.eugene;

/*-
 * #%L
 * EUGene :: EUGene Core
 * %%
 * Copyright (C) 2004 - 2017 Code Lutin, Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import org.nuiton.eugene.models.friend.ModelDef;
import org.nuiton.eugene.models.object.ObjectModel;
import org.nuiton.eugene.models.object.ObjectModelGenerator;

/**
 * Created by tchemit on 24/06/17.
 *
 * @author Tony Chemit - [email protected]
 * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.eugene.FriendTemplatesGenerator"
 */
public class FriendTemplatesGenerator extends ObjectModelGenerator {

    //TODO: tenir compte des valeurs par defaut : afficher seulement les valeurs différentes des valeurs par défaut

    @Override
    public void generateFromModel(Writer output, ObjectModel input) throws IOException {

        ModelDef modelDef = ModelDef.of(input);
        try (BufferedWriter writer = new BufferedWriter(output)) {
            modelDef.write(writer);
        }
    }

    @Override
    public String getFilenameForModel(ObjectModel model) {
        return model.getName() + ".friendmodel";
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy