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_PARSER  
    static ColumnParser<java.lang.Double> DOUBLE_COLUMN_PARSER  
    static ColumnParser<java.lang.Integer> INTEGER_COLUMN_PARSER  
    static ColumnParser<java.time.LocalDate> LOCALDATE_COLUMN_PARSER  
    static 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 T parse​(@Nullable java.lang.String value)  
    @NotNull java.lang.String toString​(T value)
    Parses the given value into a String representation suitable for SQL.
    protected @NotNull java.lang.String toStringImpl​(T value)
    Returns the String representation of the given value suitable for SQL.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • parse

      @Nullable public abstract T parse​(@Nullable @Nullable java.lang.String value) throws ParseException
      Throws:
      ParseException
      Since:
      0.14
    • toStringImpl

      @NotNull protected @NotNull java.lang.String toStringImpl​(@NotNull T value)
      Returns the String representation of the given value suitable for SQL. NOTE: For implementation it can be assumed that the value is not null since this is handled by toString(Object). The default implementation just calls String.valueOf(Object).
      Parameters:
      value - The value to convert.
      Returns:
      The String representation of the given value suitable for SQL.
      Since:
      0.1
      See Also:
      toString(Object)
    • toString

      @NotNull public final @NotNull java.lang.String toString​(@Nullable T value)
      Parses the given value into a String representation suitable for SQL. Returns the String "NULL" (without quotes) if value is null.
      Parameters:
      value - The value to convert.
      Returns:
      A String representation of the given value suitable for SQL.
      Since:
      0.1
    • getType

      @NotNull public abstract @NotNull java.lang.Class<T> 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