org.caleigo.core
Class EntityWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.FilterWriter
          extended byorg.caleigo.core.EntityWriter

public class EntityWriter
extends java.io.FilterWriter

The EntityWriter is a FilterWriter that adds write methods for wrting entities, selections and related data.

Version:
1.00
Author:
Dennis Zikovic

Field Summary
static int DEFAULT_DECIMAL_COUNT
           
protected static java.text.DateFormat sDefaultDateFormat
           
protected static java.text.NumberFormat sDefaultFloatFormat
           
protected static java.text.NumberFormat sDefaultIntegerFormat
           
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
EntityWriter(java.io.Writer out)
           
EntityWriter(java.io.Writer out, int fieldSeparator, int entitySeparator)
           
 
Method Summary
 void addBlockedDataType(DataType dataType)
          This method makes it possible to register data types that should be ignored when writing.
static java.lang.String createDragString(ISelection selection)
          Static help method that creates a string representation of a entity selection suitable for end-user display considering the default local.
static java.text.DateFormat getDefaultDateFormat()
           
static java.text.NumberFormat getDefaultFloatFormat()
           
static java.text.NumberFormat getDefaultIntegerFormat()
           
 int getFieldSeparator()
           
 java.lang.String getNullValue()
           
 int getRecordSeparator()
           
 int getStringDelimiter()
           
 boolean isDataTypeBlocked(DataType dataType)
          Returns true if the provided data type is blocked.
 boolean isPrintFormat()
          Returns true if print format is active.
static void setDefaultDateFormat(java.text.DateFormat format)
           
static void setDefaultFloatFormat(java.text.NumberFormat format)
           
static void setDefaultIntegerFormat(java.text.NumberFormat format)
           
 void setFieldSeparator(int character)
           
 void setNullValue(java.lang.String nullString)
          Setting the string mark to zero means that no string quotes will be used.
 void setPrintFormat(boolean usePrintFormat)
          Print format indicates that the data written should be formated for end-user display using the current locale settings.
 void setRecordSeparator(int character)
           
 void setStringDelimiter(int character)
           
protected  boolean useStringDelimiter(DataType dataType)
           
protected  void writeData(DataType dataType, java.lang.Object data)
           
 void writeEntity(IEntity entity)
          Writes a single entity to the writer.
 void writeFieldTitles(IEntityDescriptor entityDescriptor)
          Writes a header row with titles using the display names of the fields from the provided entity descriptor.
 void writeMappedSelection(ISelection selection)
          Writes a selection to the writer preceded with a row consisting of the source names for the fields defined by the selections entity descriptor.
 void writeSelection(ISelection selection)
          Writes a selection to the writer.
 
Methods inherited from class java.io.FilterWriter
close, flush, write, write, write
 
Methods inherited from class java.io.Writer
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DECIMAL_COUNT

public static final int DEFAULT_DECIMAL_COUNT

sDefaultDateFormat

protected static java.text.DateFormat sDefaultDateFormat

sDefaultIntegerFormat

protected static java.text.NumberFormat sDefaultIntegerFormat

sDefaultFloatFormat

protected static java.text.NumberFormat sDefaultFloatFormat
Constructor Detail

EntityWriter

public EntityWriter(java.io.Writer out)

EntityWriter

public EntityWriter(java.io.Writer out,
                    int fieldSeparator,
                    int entitySeparator)
Method Detail

createDragString

public static java.lang.String createDragString(ISelection selection)
Static help method that creates a string representation of a entity selection suitable for end-user display considering the default local.


getDefaultIntegerFormat

public static java.text.NumberFormat getDefaultIntegerFormat()

setDefaultIntegerFormat

public static void setDefaultIntegerFormat(java.text.NumberFormat format)

getDefaultFloatFormat

public static java.text.NumberFormat getDefaultFloatFormat()

setDefaultFloatFormat

public static void setDefaultFloatFormat(java.text.NumberFormat format)

getDefaultDateFormat

public static java.text.DateFormat getDefaultDateFormat()

setDefaultDateFormat

public static void setDefaultDateFormat(java.text.DateFormat format)

writeFieldTitles

public void writeFieldTitles(IEntityDescriptor entityDescriptor)
                      throws java.io.IOException
Writes a header row with titles using the display names of the fields from the provided entity descriptor.

Throws:
java.io.IOException

writeEntity

public void writeEntity(IEntity entity)
                 throws java.io.IOException
Writes a single entity to the writer.

Throws:
java.io.IOException

writeSelection

public void writeSelection(ISelection selection)
                    throws java.io.IOException
Writes a selection to the writer.

Throws:
java.io.IOException

writeMappedSelection

public void writeMappedSelection(ISelection selection)
                          throws java.io.IOException
Writes a selection to the writer preceded with a row consisting of the source names for the fields defined by the selections entity descriptor.

Throws:
java.io.IOException

getFieldSeparator

public int getFieldSeparator()

setFieldSeparator

public void setFieldSeparator(int character)

getRecordSeparator

public int getRecordSeparator()

setRecordSeparator

public void setRecordSeparator(int character)

getStringDelimiter

public int getStringDelimiter()

setStringDelimiter

public void setStringDelimiter(int character)

getNullValue

public java.lang.String getNullValue()

setNullValue

public void setNullValue(java.lang.String nullString)
Setting the string mark to zero means that no string quotes will be used.


addBlockedDataType

public void addBlockedDataType(DataType dataType)
This method makes it possible to register data types that should be ignored when writing.


isDataTypeBlocked

public boolean isDataTypeBlocked(DataType dataType)
Returns true if the provided data type is blocked.


setPrintFormat

public void setPrintFormat(boolean usePrintFormat)
Print format indicates that the data written should be formated for end-user display using the current locale settings. This affects the format of dates and numeric values. It will also ignore all fields with the hidden flag set when writing. Print format is by default not active.


isPrintFormat

public boolean isPrintFormat()
Returns true if print format is active.


writeData

protected void writeData(DataType dataType,
                         java.lang.Object data)
                  throws java.io.IOException
Throws:
java.io.IOException

useStringDelimiter

protected boolean useStringDelimiter(DataType dataType)


Copyright © 2005 Caleigo. All Rights Reserved.