Class ColumnParser<T>
java.lang.Object
bayern.steinbrecher.dbConnector.scheme.ColumnParser<T>
- Type Parameters:
T- The type to convert from and to a SQL representation.
public abstract class ColumnParser<T>
extends java.lang.Object
Contains singletons for converting objects from and to their SQL representation.
- Since:
- 0.1
-
Field Summary
Fields Modifier and Type Field Description static ColumnParser<java.lang.Boolean>BOOLEAN_COLUMN_PARSERstatic ColumnParser<java.lang.Double>DOUBLE_COLUMN_PARSERstatic ColumnParser<java.lang.Integer>INTEGER_COLUMN_PARSERstatic ColumnParser<java.time.LocalDate>LOCALDATE_COLUMN_PARSERstatic ColumnParser<java.lang.String>STRING_COLUMN_PARSER -
Method Summary
Modifier and Type Method Description abstract @NotNull java.lang.Class<T>getType()Returns the generic type of the class.abstract Tparse(@Nullable java.lang.String value)@NotNull java.lang.StringtoString(T value)Parses the given value into aStringrepresentation suitable for SQL.protected @NotNull java.lang.StringtoStringImpl(T value)Returns theStringrepresentation of the given value suitable for SQL.
-
Field Details
-
STRING_COLUMN_PARSER
- Since:
- 0.1
-
INTEGER_COLUMN_PARSER
- Since:
- 0.1
-
BOOLEAN_COLUMN_PARSER
- Since:
- 0.1
-
LOCALDATE_COLUMN_PARSER
- Since:
- 0.1
-
DOUBLE_COLUMN_PARSER
- Since:
- 0.1
-
-
Method Details
-
parse
@Nullable public abstract T parse(@Nullable @Nullable java.lang.String value) throws ParseException- Throws:
ParseException- Since:
- 0.14
-
toStringImpl
Returns theStringrepresentation of the given value suitable for SQL. NOTE: For implementation it can be assumed that the value is notnullsince this is handled bytoString(Object). The default implementation just callsString.valueOf(Object).- Parameters:
value- The value to convert.- Returns:
- The
Stringrepresentation of the given value suitable for SQL. - Since:
- 0.1
- See Also:
toString(Object)
-
toString
Parses the given value into aStringrepresentation suitable for SQL. Returns theString"NULL" (without quotes) ifvalueisnull.- Parameters:
value- The value to convert.- Returns:
- A
Stringrepresentation of the given value suitable for SQL. - Since:
- 0.1
-
getType
Returns the generic type of the class. This method is needed since type ereasure takes place.- Returns:
- The generic type of the class.
- Since:
- 0.1
-