001package io.ebeaninternal.dbmigration.ddlgeneration;
002
003import io.ebeaninternal.dbmigration.model.MConfiguration;
004
005import java.io.IOException;
006
007/**
008 * Buffer to append generated DDL to.
009 */
010public interface DdlBuffer {
011
012  /**
013   * Return the configuration (default tablespaces etc).
014   */
015  MConfiguration getConfiguration();
016
017  /**
018   * Return true if the buffer is empty.
019   */
020  boolean isEmpty();
021
022  /**
023   * Append a statement allowing for null or empty statements.
024   */
025  DdlBuffer appendStatement(String content) throws IOException;
026
027  /**
028   * Append DDL content to the buffer.
029   */
030  DdlBuffer append(String content) throws IOException;
031
032  /**
033   * Append DDL content to the buffer with space padding.
034   */
035  DdlBuffer append(String type, int space) throws IOException;
036
037  /**
038   * Append a value that is potentially null or empty and proceed it with a space if so.
039   */
040  DdlBuffer appendWithSpace(String foreignKeyRestrict) throws IOException;
041
042  /**
043   * Append new line character to the buffer.
044   */
045  DdlBuffer newLine() throws IOException;
046
047  /**
048   * Append the end of statement content.
049   */
050  DdlBuffer endOfStatement() throws IOException;
051
052  /**
053   * End of a change - add some whitespace.
054   */
055  DdlBuffer end() throws IOException;
056
057  /**
058   * Return the buffer content.
059   */
060  String getBuffer();
061
062}