ThinkUI Data Generator 1.0.2 API

thinkui.db.io
Interface DataObjectWriter

All Known Implementing Classes:
AbstractDataObjectWriter

public interface DataObjectWriter

Data object writer.


Method Summary
 void close()
          Closes the writer.
 void commit()
          Commit the current database transaction (if any).
 int getCount()
           
 FormatFactory getFormatFactory(java.lang.String attrName)
           
 java.io.OutputStream getOutputStream()
          Returns the output stream to be used or null if not applicable.
 java.io.Writer getWriter()
          Returns the writer to be used or null if not applicable.
 void init()
          Initializes the writer.
 boolean isWriteHeader()
          Returns whether or not an output header should be written.
 boolean isWriteUppercase()
          Returns whether or not output should be written in uppercase.
 void rollback()
          Rollback the current database transaction (if any).
 void setFormatFactory(java.lang.String attrName, FormatFactory factory)
          Sets the format factory for the given attribute name.
 void setOutputStream(java.io.OutputStream out)
          Sets the output stream to be used for writing the output.
 void setWriteHeader(boolean writeHeader)
          Sets whether or not an output header should be written.
 void setWriter(java.io.Writer writer)
          Sets the writer to be used for writing the output.
 void setWriteUppercase(boolean writeUppercase)
          Sets whether or not output should be written in uppercase.
 void write(DataClass dataClass)
          Write the given data class.
 DataObject write(DataObject dataObject)
          Write the given data object.
 

Method Detail

close

public void close()
           throws java.lang.Exception
Closes the writer.

Throws:
java.lang.Exception

commit

public void commit()
            throws java.lang.Exception
Commit the current database transaction (if any).

Throws:
java.lang.Exception

getCount

public int getCount()
Returns:
the number of objects that has been written.

getFormatFactory

public FormatFactory getFormatFactory(java.lang.String attrName)
Returns:
the format factory for the given attribute name or null.

getOutputStream

public java.io.OutputStream getOutputStream()
Returns the output stream to be used or null if not applicable.

Returns:
the output stream to be used or null.

getWriter

public java.io.Writer getWriter()
Returns the writer to be used or null if not applicable.

Returns:
the writer to be used or null.

init

public void init()
          throws java.lang.Exception
Initializes the writer.

Throws:
java.lang.Exception

isWriteHeader

public boolean isWriteHeader()
Returns whether or not an output header should be written.

Returns:
whether or not an output header should be written.

isWriteUppercase

public boolean isWriteUppercase()
Returns whether or not output should be written in uppercase.

Returns:
whether or not output should be written in uppercase.

rollback

public void rollback()
              throws java.lang.Exception
Rollback the current database transaction (if any).

Throws:
java.lang.Exception

setFormatFactory

public void setFormatFactory(java.lang.String attrName,
                             FormatFactory factory)
Sets the format factory for the given attribute name.


setOutputStream

public void setOutputStream(java.io.OutputStream out)
Sets the output stream to be used for writing the output.


setWriteHeader

public void setWriteHeader(boolean writeHeader)
Sets whether or not an output header should be written.


setWriter

public void setWriter(java.io.Writer writer)
Sets the writer to be used for writing the output. If not explicitly set, a writer will be created automatically based on the configure output stream (if any).


setWriteUppercase

public void setWriteUppercase(boolean writeUppercase)
Sets whether or not output should be written in uppercase.


write

public void write(DataClass dataClass)
           throws java.lang.Exception
Write the given data class.

Throws:
java.lang.Exception

write

public DataObject write(DataObject dataObject)
                 throws java.lang.Exception
Write the given data object.

The actually data object that was written (may be different from the data object that was passed in) is returned.

This is useful for example, if the primary key column of the database object is needed in a subsequent step.

Returns:
the actual data object that was written.
Throws:
java.lang.Exception

ThinkUI Data Generator 1.0.2 API

Copyright © 2007-2009. ThinkUI Software Inc. All rights reserved.