Class SimpleColumnPattern<T,​U>

java.lang.Object
bayern.steinbrecher.dbConnector.scheme.ColumnPattern<T,​U>
bayern.steinbrecher.dbConnector.scheme.SimpleColumnPattern<T,​U>
Type Parameters:
T - The type of the contents this column holds.
U - The type of object to set the content of this column to.

public class SimpleColumnPattern<T,​U>
extends ColumnPattern<T,​U>
Represents a ColumnPattern representing a specific column name instead of an actual pattern for column names.
Since:
0.1
  • Constructor Summary

    Constructors 
    Constructor Description
    SimpleColumnPattern​(@NotNull java.lang.String realColumnName, @NotNull ColumnParser<T> parser, @NotNull java.util.function.BiFunction<U,​T,​U> setter)
    Creates a new simple column pattern, i.e. a pattern which specifies a specific column name.
    SimpleColumnPattern​(@NotNull java.lang.String realColumnName, @NotNull ColumnParser<T> parser, @NotNull java.util.function.BiFunction<U,​T,​U> setter, @NotNull java.util.Optional<java.util.Optional<T>> defaultValue, boolean isPrimaryKey, boolean allowNull)
    Creates a new simple column pattern, i.e. a pattern which specifies a specific column name.
  • Method Summary

    Modifier and Type Method Description
    protected U combineImpl​(U toSet, @NotNull java.lang.String columnName, T value)  
    @NotNull java.util.Optional<java.util.Optional<T>> getDefaultValue()
    Returns the default value to set when creating a table containing this column.
    @NotNull java.lang.String getRealColumnName()
    Returns the real column name of this column.
    java.lang.String getSQLDefaultValue()  
    boolean hasDefaultValue()
    Checks whether a default value is set for this column
    boolean isAllowNull()  
    boolean isPrimaryKey()  

    Methods inherited from class bayern.steinbrecher.dbConnector.scheme.ColumnPattern

    combine, equals, getColumnNamePattern, getParser, hashCode, matches, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SimpleColumnPattern

      public SimpleColumnPattern​(@NotNull @NotNull java.lang.String realColumnName, @NotNull @NotNull ColumnParser<T> parser, @NotNull @NotNull java.util.function.BiFunction<U,​T,​U> setter)
      Creates a new simple column pattern, i.e. a pattern which specifies a specific column name. This constructor may be used if SimpleColumnPattern is an immutable type.
      Parameters:
      realColumnName - The exact name of the column to match.
      parser - The parser to convert values from and to a SQL representation.
      setter - The function used to set a parsed value to a given object. The setter should only return a new object of type SimpleColumnPattern if the handed in one is immutable.
      Since:
      0.5
    • SimpleColumnPattern

      public SimpleColumnPattern​(@NotNull @NotNull java.lang.String realColumnName, @NotNull @NotNull ColumnParser<T> parser, @NotNull @NotNull java.util.function.BiFunction<U,​T,​U> setter, @NotNull @NotNull java.util.Optional<java.util.Optional<T>> defaultValue, boolean isPrimaryKey, boolean allowNull)
      Creates a new simple column pattern, i.e. a pattern which specifies a specific column name. This constructor may be used if SimpleColumnPattern is an immutable type.
      Parameters:
      realColumnName - The exact name of the column to match.
      parser - The parser to convert values from and to a SQL representation.
      setter - The function used to set a parsed value to a given object. The setter should only return a new object of type SimpleColumnPattern if the handed in one is immutable.
      defaultValue - The default value of this column. Optional.empty() represents explicitely no default value. An Optional of an Optional.empty() represents null as default value. Otherwise the value of the inner Optional represents the default value.
      Since:
      0.5
      See Also:
      ColumnPattern(String, ColumnParser)
  • Method Details

    • combineImpl

      @NotNull protected U combineImpl​(@NotNull U toSet, @NotNull @NotNull java.lang.String columnName, @Nullable T value)
      Specified by:
      combineImpl in class ColumnPattern<T,​U>
      Since:
      0.1
      See Also:
      ColumnPattern.combine(Object, String, String)
    • getRealColumnName

      @NotNull public @NotNull java.lang.String getRealColumnName()
      Returns the real column name of this column.
      Returns:
      The real column name of this column.
      Since:
      0.1
    • hasDefaultValue

      public boolean hasDefaultValue()
      Checks whether a default value is set for this column
      Returns:
      true only if a default value is associated with this column.
      Since:
      0.1
    • getDefaultValue

      @NotNull public @NotNull java.util.Optional<java.util.Optional<T>> getDefaultValue()
      Returns the default value to set when creating a table containing this column.
      Returns:
      The default value to set when creating a table containing this column. See description of constructors.
      Since:
      0.1
    • getSQLDefaultValue

      public java.lang.String getSQLDefaultValue()
    • isPrimaryKey

      public boolean isPrimaryKey()
      Since:
      0.5
    • isAllowNull

      public boolean isAllowNull()
      Since:
      0.5