Class CsvMetadataBuilder
java.lang.Object
com.aquima.interactions.framework.util.CsvMetadataBuilder
Util class for easy datasource creation for a CSV resource connection.
- Since:
- 8.3
- Author:
- Jon van Leuven
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumnInfo
(DataType type) This method adds column information to the metadata object with a default value format.void
addColumnInfo
(DataType type, String valueFormatName) This method adds column information to the metadata objectvoid
addColumnInfo
(DataType type, String formatPattern, String localeCode) This method adds column information to the metadata objectvoid
setCharset
(String charset) void
setColumnWidths
(int[] columnWidths) This method sets the column widths for a fixed width text resource.void
setDelimiter
(char delimiter) This method sets the delimiter to use for separating entries.void
setHasRowHeaders
(boolean hasRowHeaders) This method sets if the CSV resource's first row contains the headers.void
setIsFixedWidthText
(boolean isFixedWidthText) This method sets if the resource should be parsed as a fixed width text resource.void
setQuoteCharacter
(char quoteCharacter) This method sets the character to use for quoted elements.void
toDatasource
(IConnectionParameterVisitor visitor) Use this method to add the metadata to the IConnectionParameterVisitor that is used in by the IResourceConnectionDS.
-
Field Details
-
KEY_ISFIXEDWIDTHTEXT
- See Also:
-
KEY_COLUMNWIDTHS
- See Also:
-
KEY_DELIMITER
- See Also:
-
KEY_QUOTECHARACTER
- See Also:
-
KEY_HASROWHEADERS
- See Also:
-
KEY_CHARSET
- See Also:
-
KEY_COLUMN_DATATYPE
- See Also:
-
KEY_COLUMN_FORMATPATTERN
- See Also:
-
KEY_COLUMN_LOCALECODE
- See Also:
-
KEY_COLUMN_VALUEFORMATNAME
- See Also:
-
-
Constructor Details
-
CsvMetadataBuilder
public CsvMetadataBuilder()
-
-
Method Details
-
addColumnInfo
This method adds column information to the metadata object- Parameters:
type
- The datatype of the column, may not be null.formatPattern
- The format pattern of the column, may be null.localeCode
- The format pattern of the column, may be null (may not be null when a pattern is provided).
-
addColumnInfo
This method adds column information to the metadata object- Parameters:
type
- The datatype of the column, may not be null.valueFormatName
- The name of the value format that should be used, may be null.
-
addColumnInfo
This method adds column information to the metadata object with a default value format.- Parameters:
type
- The datatype of the column, may not be null.
-
setIsFixedWidthText
public void setIsFixedWidthText(boolean isFixedWidthText) This method sets if the resource should be parsed as a fixed width text resource.- Parameters:
isFixedWidthText
- if the resource should be parsed as a fixed width text resource.
-
setColumnWidths
public void setColumnWidths(int[] columnWidths) This method sets the column widths for a fixed width text resource.- Parameters:
columnWidths
- the column widths for a fixed width text resource.
-
setDelimiter
public void setDelimiter(char delimiter) This method sets the delimiter to use for separating entries.- Parameters:
delimiter
- the delimiter to use for separating entries.
-
setQuoteCharacter
public void setQuoteCharacter(char quoteCharacter) This method sets the character to use for quoted elements.- Parameters:
quoteCharacter
- the character to use for quoted elements.
-
setHasRowHeaders
public void setHasRowHeaders(boolean hasRowHeaders) This method sets if the CSV resource's first row contains the headers.- Parameters:
hasRowHeaders
- if the CSV resource's first row contains the headers.
-
setCharset
-
toDatasource
Use this method to add the metadata to the IConnectionParameterVisitor that is used in by the IResourceConnectionDS.- Parameters:
visitor
- The visitor to add the csv metadata to.- Throws:
InitializationException
- This exception is thrown when the connection definition could not be added.
-