io.debezium.config.Field.defaultValueAsString()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中io.debezium.config.Field.defaultValueAsString()方法的一些代码示例,展示了Field.defaultValueAsString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.defaultValueAsString()方法的具体详情如下:
包路径:io.debezium.config.Field
类名称:Field
方法名:defaultValueAsString

Field.defaultValueAsString介绍

[英]Get the string representation of the default value of the field.
[中]获取字段默认值的字符串表示形式。

代码示例

代码示例来源:origin: debezium/debezium

/**
 * Get the long value associated with the given field, returning the field's default value if there is no such
 * key-value pair.
 *
 * @param field the field
 * @return the integer value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as a long value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default long getLong(Field field) {
  return getLong(field.name(), () -> Long.valueOf(field.defaultValueAsString())).longValue();
}

代码示例来源:origin: debezium/debezium

/**
 * Get the boolean value associated with the given field when that field has a default value. If the configuration does
 * not have a name-value pair with the same name as the field, then the field's default value.
 *
 * @param field the field
 * @return the boolean value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as a boolean value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default boolean getBoolean(Field field) {
  return getBoolean(field.name(), () -> Boolean.valueOf(field.defaultValueAsString())).booleanValue();
}

代码示例来源:origin: debezium/debezium

/**
 * Get the integer value associated with the given field, returning the field's default value if there is no such
 * key-value pair.
 *
 * @param field the field
 * @return the integer value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as an integer value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default int getInteger(Field field) {
  return getInteger(field.name(), () -> Integer.valueOf(field.defaultValueAsString())).intValue();
}

代码示例来源:origin: debezium/debezium

protected SnapshotMode snapshotMode() {
  String value = config.getString(MySqlConnectorConfig.SNAPSHOT_MODE);
  return SnapshotMode.parse(value, MySqlConnectorConfig.SNAPSHOT_MODE.defaultValueAsString());
}

代码示例来源:origin: debezium/debezium

@Override
public Builder changeString(Field field, Function<String, String> function) {
  return changeString(field.name(), field.defaultValueAsString(), function);
}

代码示例来源:origin: debezium/debezium

/**
 * Get the string value associated with the given field, returning the field's default value if there is no such key-value
 * pair in this configuration.
 *
 * @param field the field; may not be null
 * @return the configuration's value for the field, or the field's {@link Field#defaultValue() default value} if there is no
 *         such key-value pair in the configuration
 */
default String getString(Field field) {
  return getString(field.name(), field.defaultValueAsString());
}

代码示例来源:origin: debezium/debezium

/**
 * Get the string value associated with the given field, returning the field's default value if there is no such key-value
 * pair in this configuration.
 *
 * @param field the field; may not be null
 * @param defaultValue the default value
 * @return the configuration's value for the field, or the field's {@link Field#defaultValue() default value} if there is no
 *         such key-value pair in the configuration
 */
default String getString(Field field, String defaultValue) {
  return getString(field.name(), () -> {
    String value = field.defaultValueAsString();
    return value != null ? value : defaultValue;
  });
}

代码示例来源:origin: debezium/debezium

/**
 * Get the numeric value associated with the given field, returning the field's default value if there is no such
 * key-value pair.
 *
 * @param field the field
 * @return the integer value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as an integer value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default Number getNumber(Field field) {
  return getNumber(field.name(), () -> Strings.asNumber(field.defaultValueAsString()));
}

代码示例来源:origin: debezium/debezium

public MySqlConnectorConfig(Configuration config) {
  super(
      config,
      config.getString(SERVER_NAME),
      null, // TODO whitelist handling is still done locally here
      null
  );
  // If deprecated snapshot.minimal.locking property is explicitly configured
  if (config.hasKey(MySqlConnectorConfig.SNAPSHOT_MINIMAL_LOCKING.name())) {
    // Coerce it into its replacement appropriate snapshot.locking.mode value
    if (config.getBoolean(MySqlConnectorConfig.SNAPSHOT_MINIMAL_LOCKING)) {
      this.snapshotLockingMode = SnapshotLockingMode.MINIMAL;
    } else {
      this.snapshotLockingMode = SnapshotLockingMode.EXTENDED;
    }
  } else {
    // Otherwise use configured snapshot.locking.mode configuration.
    this.snapshotLockingMode = SnapshotLockingMode.parse(config.getString(SNAPSHOT_LOCKING_MODE), SNAPSHOT_LOCKING_MODE.defaultValueAsString());
  }
  String ddlParsingModeStr = config.getString(MySqlConnectorConfig.DDL_PARSER_MODE);
  this.ddlParsingMode = DdlParsingMode.parse(ddlParsingModeStr, MySqlConnectorConfig.DDL_PARSER_MODE.defaultValueAsString());
  String gitIdNewChannelPosition = config.getString(MySqlConnectorConfig.GTID_NEW_CHANNEL_POSITION);
  this.gitIdNewChannelPosition = GtidNewChannelPosition.parse(gitIdNewChannelPosition, MySqlConnectorConfig.GTID_NEW_CHANNEL_POSITION.defaultValueAsString());
  String snapshotNewTables = config.getString(MySqlConnectorConfig.SNAPSHOT_NEW_TABLES);
  this.snapshotNewTables = SnapshotNewTables.parse(snapshotNewTables, MySqlConnectorConfig.SNAPSHOT_NEW_TABLES.defaultValueAsString());
}

代码示例来源:origin: debezium/debezium

public SqlServerConnectorConfig(Configuration config) {
  super(config, config.getString(LOGICAL_NAME), new SystemTablesPredicate(), x -> x.schema() + "." + x.table());
  this.databaseName = config.getString(DATABASE_NAME);
  this.snapshotMode = SnapshotMode.parse(config.getString(SNAPSHOT_MODE), SNAPSHOT_MODE.defaultValueAsString());
  this.snapshotIsolationMode = SnapshotIsolationMode.parse(config.getString(SNAPSHOT_ISOLATION_MODE), SNAPSHOT_ISOLATION_MODE.defaultValueAsString());
  this.columnFilter = Predicates.excludes(config.getString(RelationalDatabaseConnectorConfig.COLUMN_BLACKLIST),
      columnId -> String.format("%s.%s.%s", columnId.schema(), columnId.table(), columnId.columnName()));
}

代码示例来源:origin: debezium/debezium

assertThat(context.getConnectorConfig().getLogicalName()).isEqualTo(serverName);
assertThat("" + context.includeSchemaChangeRecords()).isEqualTo(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES.defaultValueAsString());
assertThat("" + context.includeSqlQuery()).isEqualTo(MySqlConnectorConfig.INCLUDE_SQL_QUERY.defaultValueAsString());
assertThat("" + context.getConnectorConfig().getMaxBatchSize()).isEqualTo(MySqlConnectorConfig.MAX_BATCH_SIZE.defaultValueAsString());
assertThat("" + context.getConnectorConfig().getMaxQueueSize()).isEqualTo(MySqlConnectorConfig.MAX_QUEUE_SIZE.defaultValueAsString());
assertThat("" + context.getConnectorConfig().getPollInterval().toMillis()).isEqualTo(MySqlConnectorConfig.POLL_INTERVAL_MS.defaultValueAsString());
assertThat("" + context.snapshotMode().getValue()).isEqualTo(MySqlConnectorConfig.SNAPSHOT_MODE.defaultValueAsString());

代码示例来源:origin: io.debezium/debezium-core

/**
 * Get the long value associated with the given field, returning the field's default value if there is no such
 * key-value pair.
 *
 * @param field the field
 * @return the integer value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as a long value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default long getLong(Field field) {
  return getLong(field.name(), () -> Long.valueOf(field.defaultValueAsString())).longValue();
}

代码示例来源:origin: io.debezium/debezium-core

/**
 * Get the integer value associated with the given field, returning the field's default value if there is no such
 * key-value pair.
 *
 * @param field the field
 * @return the integer value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as an integer value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default int getInteger(Field field) {
  return getInteger(field.name(), () -> Integer.valueOf(field.defaultValueAsString())).intValue();
}

代码示例来源:origin: io.debezium/debezium-core

/**
 * Get the boolean value associated with the given field when that field has a default value. If the configuration does
 * not have a name-value pair with the same name as the field, then the field's default value.
 *
 * @param field the field
 * @return the boolean value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as a boolean value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default boolean getBoolean(Field field) {
  return getBoolean(field.name(), () -> Boolean.valueOf(field.defaultValueAsString())).booleanValue();
}

代码示例来源:origin: io.debezium/debezium-core

/**
 * Get the string value associated with the given field, returning the field's default value if there is no such key-value
 * pair in this configuration.
 *
 * @param field the field; may not be null
 * @return the configuration's value for the field, or the field's {@link Field#defaultValue() default value} if there is no
 *         such key-value pair in the configuration
 */
default String getString(Field field) {
  return getString(field.name(), field.defaultValueAsString());
}

代码示例来源:origin: io.debezium/debezium-core

@Override
public Builder changeString(Field field, Function<String, String> function) {
  return changeString(field.name(), field.defaultValueAsString(), function);
}

代码示例来源:origin: io.debezium/debezium-core

/**
 * Get the string value associated with the given field, returning the field's default value if there is no such key-value
 * pair in this configuration.
 *
 * @param field the field; may not be null
 * @param defaultValue the default value
 * @return the configuration's value for the field, or the field's {@link Field#defaultValue() default value} if there is no
 *         such key-value pair in the configuration
 */
default String getString(Field field, String defaultValue) {
  return getString(field.name(), () -> {
    String value = field.defaultValueAsString();
    return value != null ? value : defaultValue;
  });
}

代码示例来源:origin: io.debezium/debezium-core

/**
 * Get the numeric value associated with the given field, returning the field's default value if there is no such
 * key-value pair.
 *
 * @param field the field
 * @return the integer value, or null if the key is null, there is no such key-value pair in the configuration and there is
 *         no default value in the field or the default value could not be parsed as a long, or there is a key-value pair in
 *         the configuration but the value could not be parsed as an integer value
 * @throws NumberFormatException if there is no name-value pair and the field has no default value
 */
default Number getNumber(Field field) {
  return getNumber(field.name(), () -> Strings.asNumber(field.defaultValueAsString()));
}

代码示例来源:origin: io.debezium/debezium-connector-mysql

assertThat(context.getConnectorConfig().getLogicalName()).isEqualTo(serverName);
assertThat("" + context.includeSchemaChangeRecords()).isEqualTo(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES.defaultValueAsString());
assertThat("" + context.includeSqlQuery()).isEqualTo(MySqlConnectorConfig.INCLUDE_SQL_QUERY.defaultValueAsString());
assertThat("" + context.getConnectorConfig().getMaxBatchSize()).isEqualTo(MySqlConnectorConfig.MAX_BATCH_SIZE.defaultValueAsString());
assertThat("" + context.getConnectorConfig().getMaxQueueSize()).isEqualTo(MySqlConnectorConfig.MAX_QUEUE_SIZE.defaultValueAsString());
assertThat("" + context.getConnectorConfig().getPollInterval().toMillis()).isEqualTo(MySqlConnectorConfig.POLL_INTERVAL_MS.defaultValueAsString());
assertThat("" + context.snapshotMode().getValue()).isEqualTo(MySqlConnectorConfig.SNAPSHOT_MODE.defaultValueAsString());

相关文章