net.sf.dewdrop.sqlml
Class SqlmlComponent

java.lang.Object
  extended bynet.sf.dewdrop.sqlml.SqlmlComponent
Direct Known Subclasses:
Expression, SchemaComponent, Sqlml, Value

public abstract class SqlmlComponent
extends Object

Base class of all Sqlml elements

Author:
Les A. Hazlewood

Field Summary
protected  int indentLevel
           
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
protected SqlmlComponent()
           
 
Method Summary
 boolean equals(Object o)
           
protected  int getIndentLevel()
           
protected  String i18n(String key)
           
protected  String i18n(String key, Object parameter)
           
protected  String i18n(String key, Object[] parameters)
           
protected abstract  void onWriteSql(Writer out, Configuration cfg)
           
protected  void setIndentLevel(int indentLevel)
           
 String toSql()
          Returns the String output of this SqlmlComponent and all of its child components.
 String toSql(Configuration configuration)
          Returns the String output of this SqlmlComponent and all of its child components.
 String toSql(Dialect dialect)
          Returns the String output of this SqlmlComponent and all of its child components.
 String toString()
           
 void writeSql(Writer out)
          Outputs the SQL for this SchemaComponent and all of its child components to the specified character Writer according to the system default configuration and dialect.
 void writeSql(Writer out, Configuration configuration)
          Outputs the SQL for this SchemaComponent and all of its child components to the specified character Writer customized according to the specified configuration parameter.
 void writeSql(Writer out, Dialect dialect)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final transient org.apache.commons.logging.Log logger

indentLevel

protected int indentLevel
Constructor Detail

SqlmlComponent

protected SqlmlComponent()
Method Detail

getIndentLevel

protected int getIndentLevel()

setIndentLevel

protected void setIndentLevel(int indentLevel)

toSql

public String toSql()
Returns the String output of this SqlmlComponent and all of its child components. The output will be formatted according to the system default configuration using a generic Dialect acceptable for the majority of RDBMS distributions. The resulting string can be directly fed to a RDBMS sql interpreter for processing.

This method can be thought of a convenience method and really only executes the following:

return toSql( Configuration.DEFAULT_CONFIG );

To ensure the output is potentially better suited for a specific RDBMS vendor, consider using the toSql(Dialect) and toSql( Configuration ) methods.

Returns:
The SQL (String) representation of this SchemaComponent, using the system default Configuration and Dialect.
See Also:
toSql( Configuration ), toSql( Dialect ), Configuration, Dialect

toSql

public String toSql(Dialect dialect)
Returns the String output of this SqlmlComponent and all of its child components. The output will be formatted according to the system default configuration using the specified dialect parameter. The resulting string can be directly fed to the dialect's RDBMS sql interpreter for processing.

This method is a convenience method and really only executes the following:

return toSql( new Configuration( dialect ) );

If you wish to format the output in a specific manner, try using a custom configuration via the toSql( Configuration ) method.

Returns:
The SQL (String) representation of this SchemaComponent, using the system default Configuration with the specified Dialect.
See Also:
toSql( Configuration ), Configuration

toSql

public String toSql(Configuration configuration)
Returns the String output of this SqlmlComponent and all of its child components. The output will be formatted according to the specified configuration parameter for the configuration's SQL dialect as determined by configuration.getDialect(). The resulting string can be directly fed to the dialect's RDBMS's SQL interpreter for processing.

Returns:
The SQL (String) representation of this SchemaComponent, using specified Configuration.
See Also:
toSql( Configuration ), Configuration

writeSql

public void writeSql(Writer out)
Outputs the SQL for this SchemaComponent and all of its child components to the specified character Writer according to the system default configuration and dialect.

Parameters:
out - the Writer to which the SQL will be written.
See Also:
toSql()

writeSql

public void writeSql(Writer out,
                     Dialect dialect)

writeSql

public void writeSql(Writer out,
                     Configuration configuration)
Outputs the SQL for this SchemaComponent and all of its child components to the specified character Writer customized according to the specified configuration parameter.


onWriteSql

protected abstract void onWriteSql(Writer out,
                                   Configuration cfg)

i18n

protected String i18n(String key)

i18n

protected String i18n(String key,
                      Object parameter)

i18n

protected String i18n(String key,
                      Object[] parameters)

equals

public boolean equals(Object o)

toString

public String toString()