/**
   * @param jdbcAdaptor the JDBC adaptor
   * @param primaryTable the primary table
   * @param metadata the metadata
   * @since 2.0.0
   */
  public DiscriminatorColumn(
      JdbcAdaptor jdbcAdaptor, EntityTable primaryTable, DiscriminatorColumnMetadata metadata) {
    super(
        DiscriminatorColumn.getJavaType(metadata),
        null,
        null,
        null,
        false,
        metadata != null ? metadata.getLocator() : null);

    this.name = jdbcAdaptor.escape(metadata != null ? metadata.getName() : "DTYPE");
    this.table = primaryTable;

    this.columnDefinition = metadata != null ? metadata.getColumnDefinition() : null;
    this.discriminatorType =
        metadata != null ? metadata.getDiscriminatorType() : DiscriminatorType.STRING;
    this.length =
        metadata != null
            ? (metadata.getDiscriminatorType() == DiscriminatorType.CHAR ? 1 : metadata.getLength())
            : 31;

    this.table.addColumn(this);
  }