Package org.relique.jdbc.csv
Class StringConverter
- java.lang.Object
-
- org.relique.jdbc.csv.StringConverter
-
public class StringConverter extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COLUMN_NAME
-
Constructor Summary
Constructors Constructor Description StringConverter(java.lang.String dateformat, java.lang.String timeformat, java.lang.String timestampformat, java.lang.String timeZoneName)
StringConverter(java.lang.String dateformat, java.lang.String timeformat, java.lang.String timestampformat, java.lang.String timeZoneName, java.util.Locale locale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
convert(java.lang.String sqlTypeName, java.lang.String stringRepresentation)
java.lang.String
formatDate(java.sql.Date d)
Create date string in format accepted by methodparseDate
.java.lang.String
formatTime(java.sql.Time t)
Create time string in format accepted by methodparseTime
.java.lang.String
formatTimestamp(java.sql.Timestamp timestamp)
Create timestamp string in format accepted by methodparseTimestamp
.java.lang.Class<?>
forSQLName(java.lang.String sqlTypeName)
static java.lang.Object
getLiteralForTypeName(java.lang.String sqlTypeName)
Get a value that has the type of an SQL data type.static java.util.List<java.lang.Object[]>
getTypeInfo()
static java.lang.String
getTypeNameForLiteral(java.lang.Object literal)
Get SQL data type of an object.java.io.InputStream
parseAsciiStream(java.lang.String str)
java.math.BigDecimal
parseBigDecimal(java.lang.String str)
java.lang.Boolean
parseBoolean(java.lang.String str)
java.lang.Byte
parseByte(java.lang.String str)
byte[]
parseBytes(java.lang.String str)
java.sql.Date
parseDate(java.lang.String str)
java.lang.Double
parseDouble(java.lang.String str)
java.lang.Float
parseFloat(java.lang.String str)
java.lang.Integer
parseInt(java.lang.String str)
java.lang.Long
parseLong(java.lang.String str)
java.lang.Short
parseShort(java.lang.String str)
java.lang.String
parseString(java.lang.String str)
java.sql.Time
parseTime(java.lang.String str)
java.sql.Timestamp
parseTimestamp(java.lang.String str)
static java.lang.String
removeQuotes(java.lang.String string)
-
-
-
Field Detail
-
COLUMN_NAME
public static final java.lang.String COLUMN_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StringConverter
public StringConverter(java.lang.String dateformat, java.lang.String timeformat, java.lang.String timestampformat, java.lang.String timeZoneName)
-
StringConverter
public StringConverter(java.lang.String dateformat, java.lang.String timeformat, java.lang.String timestampformat, java.lang.String timeZoneName, java.util.Locale locale)
-
-
Method Detail
-
parseString
public java.lang.String parseString(java.lang.String str)
-
parseBoolean
public java.lang.Boolean parseBoolean(java.lang.String str)
-
parseByte
public java.lang.Byte parseByte(java.lang.String str)
-
parseShort
public java.lang.Short parseShort(java.lang.String str)
-
parseInt
public java.lang.Integer parseInt(java.lang.String str)
-
parseLong
public java.lang.Long parseLong(java.lang.String str)
-
parseFloat
public java.lang.Float parseFloat(java.lang.String str)
-
parseDouble
public java.lang.Double parseDouble(java.lang.String str)
-
parseBytes
public byte[] parseBytes(java.lang.String str)
-
parseBigDecimal
public java.math.BigDecimal parseBigDecimal(java.lang.String str)
-
parseDate
public java.sql.Date parseDate(java.lang.String str)
-
formatDate
public java.lang.String formatDate(java.sql.Date d)
Create date string in format accepted by methodparseDate
.- Parameters:
d
- date to format.- Returns:
- formatted date.
-
parseTime
public java.sql.Time parseTime(java.lang.String str)
-
formatTime
public java.lang.String formatTime(java.sql.Time t)
Create time string in format accepted by methodparseTime
.- Parameters:
t
- time to format.- Returns:
- formatted time.
-
parseTimestamp
public java.sql.Timestamp parseTimestamp(java.lang.String str)
-
formatTimestamp
public java.lang.String formatTimestamp(java.sql.Timestamp timestamp)
Create timestamp string in format accepted by methodparseTimestamp
.- Parameters:
timestamp
- timestamp to format.- Returns:
- formatted timestamp.
-
parseAsciiStream
public java.io.InputStream parseAsciiStream(java.lang.String str)
-
convert
public java.lang.Object convert(java.lang.String sqlTypeName, java.lang.String stringRepresentation)
-
forSQLName
public java.lang.Class<?> forSQLName(java.lang.String sqlTypeName)
-
getLiteralForTypeName
public static java.lang.Object getLiteralForTypeName(java.lang.String sqlTypeName)
Get a value that has the type of an SQL data type.- Parameters:
sqlTypeName
- name of SQL data type.- Returns:
- a constant value with this data type.
-
getTypeNameForLiteral
public static java.lang.String getTypeNameForLiteral(java.lang.Object literal)
Get SQL data type of an object.- Parameters:
literal
- object to get SQL data type for.- Returns:
- SQL data type name.
-
getTypeInfo
public static java.util.List<java.lang.Object[]> getTypeInfo()
-
removeQuotes
public static java.lang.String removeQuotes(java.lang.String string)
-
-