org.unitils.dbmaintainer.script
Class StatementBuilder

java.lang.Object
  extended by org.unitils.dbmaintainer.script.StatementBuilder
Direct Known Subclasses:
OracleScriptParser.OracleStatementBuilder

public class StatementBuilder
extends Object

A class for building statements.

Author:
Stefan Bangels, Tim Ducheyne, Filip Neven

Constructor Summary
StatementBuilder()
           
 
Method Summary
 void append(char c)
          Append a character to the statement.
 void clear()
          Clear the statement.
 String createStatement()
          Creates the resulting statement out of the given characters.
 int getLength()
          Returns the length (character count) of the statement.
 char[] getTrailingSeparatorCharsToRemove()
          Returns the characters that should be removed from the statements.
 boolean isExecutable()
           
 void setExecutable(boolean executable)
          Change the statement executable flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatementBuilder

public StatementBuilder()
Method Detail

isExecutable

public boolean isExecutable()
Returns:
True if the the statement is executable

setExecutable

public void setExecutable(boolean executable)
Change the statement executable flag.

Parameters:
executable - True if the statement is executable

append

public void append(char c)
Append a character to the statement.

Parameters:
c - The character

getLength

public int getLength()
Returns the length (character count) of the statement.

Returns:
The length (character count) of the statement.

clear

public void clear()
Clear the statement.


getTrailingSeparatorCharsToRemove

public char[] getTrailingSeparatorCharsToRemove()
Returns the characters that should be removed from the statements. Semi-colons are not part of a statement and should therefore be removed from the statement.

Returns:
The separator characters to remove, not null

createStatement

public String createStatement()
Creates the resulting statement out of the given characters. This will trim the statement and remove any trailing separtors if needed.

Returns:
The resulting statement, null if no statement is left


Copyright © 2011. All Rights Reserved.