package projet; public interface BlocRenderer { String renderTexte(String contenu); String renderListe(String contenu); String renderTitre(String contenu); String renderCode(String contenu); String renderPage(String contenu); String renderSeparateur(); String renderCitation(String contenu); default String render(Bloc bloc) { switch (bloc.getType()) { case TEXTE: return renderTexte(bloc.getContenu()); case LISTE: return renderListe(bloc.getContenu()); case TITRE: return renderTitre(bloc.getContenu()); case CODE: return renderCode(bloc.getContenu()); case PAGE: return renderPage(bloc.getContenu()); case SEPARATEUR: return renderSeparateur(); case CITATION: return renderCitation(bloc.getContenu()); default: throw new IllegalArgumentException("Type de bloc inconnu : " + bloc.getType()); } } }