Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.0.0)

E17483-01

oracle.adf.model.adapter.dataformat
Class CSVHandler

java.lang.Object
  extended by oracle.adf.model.adapter.dataformat.CSVHandler
All Implemented Interfaces:
FormatDataHandler, FormatStructureHandler

public class CSVHandler
extends java.lang.Object
implements FormatDataHandler, FormatStructureHandler

Format handler for character separated values.

This class generates structures according to the JSR 227 specification from a CSV data stream by parsing the data. The data types are guessed from the value of the first data line. It can extract values from a CSV data stream as well.

Data controls that deals with CSV data can use this class to generate data and structure.

Since:
10.1.3

Nested Class Summary
 class CSVHandler.CSVDataEvent
          Event that the CSV handler sends during processing csv data.
 
Field Summary
static java.lang.String EV_EOD
          End of data event.
static java.lang.String FILTERING_COLFORMAT_MAP
           
static java.lang.String FILTERING_COLTYPE_MAP
           
 
Constructor Summary
CSVHandler(java.io.InputStream is, boolean isFirstRowNames, java.lang.String encodingStyle, java.lang.String delim, java.lang.String quoteChar)
          Creats a CSV format handler object.
 
Method Summary
 java.util.Iterator getResult(java.util.Map params)
          Returns the resulting data extracted from the input.
 java.lang.Object getResult(java.util.Map params, java.lang.String returnType)
          Returns the resulting data extracted from the input.
 StructureDefinition getStructure(java.lang.String name, DefinitionContext ctx)
          Returns the structure definition extracted for the data format.
 void setColFormatMap(java.util.Map colFormatMap)
          Sets the map for column name - format.
 void setColTypeMap(java.util.Map colTypeMap)
          Sets the map for column name -type.
 void setDataEventListener(FormatDataEventListener listener)
          Sets the data event listener.
 void setFilterConditions(boolean isAll, java.lang.String[] conditions)
          Sets the filtering conditions for the csv data.
 void setParameters(ParameterDefinition[] params)
          Sets the parameter names for the definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTERING_COLTYPE_MAP

public static final java.lang.String FILTERING_COLTYPE_MAP
See Also:
Constant Field Values

FILTERING_COLFORMAT_MAP

public static final java.lang.String FILTERING_COLFORMAT_MAP
See Also:
Constant Field Values

EV_EOD

public static final java.lang.String EV_EOD
End of data event.

See Also:
Constant Field Values
Constructor Detail

CSVHandler

public CSVHandler(java.io.InputStream is,
                  boolean isFirstRowNames,
                  java.lang.String encodingStyle,
                  java.lang.String delim,
                  java.lang.String quoteChar)
Creats a CSV format handler object.

Parameters:
is - input stream that contains the CSV data.
isFirstRowNames - flag to indicate if the first row of the CSV data can be treated as column names.
encodingStyle - encoding style of the data.
delim - character value separators.
quoteChar - value that can be treated as quote.
Method Detail

setDataEventListener

public void setDataEventListener(FormatDataEventListener listener)
Sets the data event listener.


setParameters

public void setParameters(ParameterDefinition[] params)
Sets the parameter names for the definition. The parameter names will be used to define the structure of the data.


setFilterConditions

public void setFilterConditions(boolean isAll,
                                java.lang.String[] conditions)
Sets the filtering conditions for the csv data.


setColTypeMap

public void setColTypeMap(java.util.Map colTypeMap)
Sets the map for column name -type.


setColFormatMap

public void setColFormatMap(java.util.Map colFormatMap)
Sets the map for column name - format.


getStructure

public StructureDefinition getStructure(java.lang.String name,
                                        DefinitionContext ctx)
Returns the structure definition extracted for the data format.

Specified by:
getStructure in interface FormatStructureHandler
Parameters:
name - name of the root structure.
ctx - definition context information.
Returns:
the structure information extracted.

getResult

public java.lang.Object getResult(java.util.Map params,
                                  java.lang.String returnType)
Returns the resulting data extracted from the input.

Specified by:
getResult in interface FormatDataHandler
Parameters:
params - parameters passed containig the context information.
returnType - data type of the returned value. This can be passed as null. If no return type is specified, an Iterator of Map will be returned.
Returns:
Object of the type defined by the returnType parameter. If the type is available, an instance of that object is created. If no type is specified an Iterator of Map objects for the result will be created. If no data found it can return null. The Map contains the value of attributes as defined in the data structure. For complex data, Maps can contain other Maps as well.

getResult

public java.util.Iterator getResult(java.util.Map params)
Returns the resulting data extracted from the input.

Parameters:
params - parameters passed containig the context information.
Returns:
Iterator of Map objects for the result. If no data found it can return null. The Map contains the value of attributes as defined in the data structure. For complex data, Maps can contain other iterator of Maps as well.

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.0.0)

E17483-01

Copyright © 1997, 2011, Oracle. All rights reserved.