com.alibaba.datax.common.util.Configuration.getBool()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(177)

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

Configuration.getBool介绍

[英]根据用户提供的json path,寻址Boolean对象
[中]根据用户提供的json路径寻址布尔值对象

代码示例

代码示例来源:origin: ECNU-1X/DataX-Masking

/**
 * 根据用户提供的json path,寻址Boolean对象,如果对象不存在,返回默认Boolean对象
 * 
 * @return Boolean对象,如果path不存在或者Boolean不存在,返回默认Boolean对象
 */
public Boolean getBool(final String path, boolean defaultValue) {
  Boolean result = this.getBool(path);
  if (null == result) {
    return defaultValue;
  }
  return result;
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static boolean isCleanup(Configuration conf) {
  return conf.getBool("cleanup", false);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static boolean isIgnoreParseError(Configuration conf) {
  return conf.getBool("ignoreParseError", true);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static boolean isDiscovery(Configuration conf) {
  return conf.getBool("discovery", false);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static boolean isCompression(Configuration conf) {
  return conf.getBool("compression", true);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static boolean isIgnoreWriteError(Configuration conf) {
  return conf.getBool("ignoreWriteError", false);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static boolean getDynamic(Configuration conf) {
    return conf.getBool("dynamic", false);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static boolean isMultiThread(Configuration conf) {
  return conf.getBool("multiThread", true);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

@Override
public void  prepare(){
  Boolean truncate = originConfig.getBool(Key.TRUNCATE,false);
  if(truncate){
    Hbase11xHelper.truncateTable(this.originConfig);
  }
}
@Override

代码示例来源:origin: ECNU-1X/DataX-Masking

public Boolean getNecessaryBool(String key, ErrorCode errorCode) {
  Boolean value = this.getBool(key);
  if (value == null) {
    throw DataXException.asDataXException(errorCode,
        String.format("您提供配置文件有误,[%s]是必填参数,不允许为空或者留白 .", key));
  }
  return value;
}

代码示例来源:origin: ECNU-1X/DataX-Masking

@Override
public void  prepare(){
  Boolean truncate = originConfig.getBool(Key.TRUNCATE,false);
  if(truncate){
    Hbase094xHelper.truncateTable(this.originConfig);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static byte[] convertUserEndRowkey(com.alibaba.datax.common.util.Configuration configuration) {
  String endRowkey = configuration.getString(Key.END_ROWKEY);
  if (StringUtils.isBlank(endRowkey)) {
    return HConstants.EMPTY_BYTE_ARRAY;
  } else {
    boolean isBinaryRowkey = configuration.getBool(Key.IS_BINARY_ROWKEY);
    return Hbase11xHelper.stringToBytes(endRowkey, isBinaryRowkey);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static byte[] convertUserStartRowkey(Configuration configuration) {
  String startRowkey = configuration.getString(Key.START_ROWKEY);
  if (StringUtils.isBlank(startRowkey)) {
    return HConstants.EMPTY_BYTE_ARRAY;
  } else {
    boolean isBinaryRowkey = configuration.getBool(Key.IS_BINARY_ROWKEY);
    return Hbase094xHelper.stringToBytes(startRowkey, isBinaryRowkey);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static byte[] convertUserEndRowkey(Configuration configuration) {
  String endRowkey = configuration.getString(Key.END_ROWKEY);
  if (StringUtils.isBlank(endRowkey)) {
    return HConstants.EMPTY_BYTE_ARRAY;
  } else {
    boolean isBinaryRowkey = configuration.getBool(Key.IS_BINARY_ROWKEY);
    return Hbase094xHelper.stringToBytes(endRowkey, isBinaryRowkey);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static byte[] convertUserStartRowkey(com.alibaba.datax.common.util.Configuration configuration) {
  String startRowkey = configuration.getString(Key.START_ROWKEY);
  if (StringUtils.isBlank(startRowkey)) {
    return HConstants.EMPTY_BYTE_ARRAY;
  } else {
    boolean isBinaryRowkey = configuration.getBool(Key.IS_BINARY_ROWKEY);
    return Hbase11xHelper.stringToBytes(startRowkey, isBinaryRowkey);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

private void dealHint(Configuration originalConfig) {
    String hint = originalConfig.getString(Key.HINT);
    if (StringUtils.isNotBlank(hint)) {
      boolean isTableMode = originalConfig.getBool(com.alibaba.datax.plugin.rdbms.reader.Constant.IS_TABLE_MODE).booleanValue();
      if(!isTableMode){
        throw DataXException.asDataXException(OracleReaderErrorCode.HINT_ERROR, "当且仅当非 querySql 模式读取 oracle 时才能配置 HINT.");
      }
      HintUtil.initHintConf(DATABASE_TYPE, originalConfig);
    }
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public static List<Configuration> doSplit(Configuration originalConfig, Odps odps,
                     int adviceNum) {
  boolean isPartitionedTable = originalConfig.getBool(Constant.IS_PARTITIONED_TABLE);
  if (isPartitionedTable) {
    // 分区表
    return splitPartitionedTable(odps, originalConfig, adviceNum);
  } else {
    // 非分区表
    return splitForNonPartitionedTable(odps, adviceNum, originalConfig);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

@Override
public void init() {
  this.readerSliceConfig = super.getPluginJobConf();
  this.columns = this.readerSliceConfig.getList(Key.COLUMN,
      String.class);
  this.sliceRecordCount = this.readerSliceConfig
      .getLong(Key.SLICE_RECORD_COUNT);
  this.haveMixupFunction = this.readerSliceConfig.getBool(
      Constant.HAVE_MIXUP_FUNCTION, false);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public HbaseAbstractTask(com.alibaba.datax.common.util.Configuration configuration) {
  this.htable = Hbase094xHelper.getTable(configuration);
  this.columns = configuration.getListConfiguration(Key.COLUMN);
  this.rowkeyColumn = configuration.getListConfiguration(Key.ROWKEY_COLUMN);
  this.versionColumn = configuration.getConfiguration(Key.VERSION_COLUMN);
  this.encoding = configuration.getString(Key.ENCODING,Constant.DEFAULT_ENCODING);
  this.nullMode = NullModeType.getByTypeName(configuration.getString(Key.NULL_MODE,Constant.DEFAULT_NULL_MODE));
  this.walFlag = configuration.getBool(Key.WAL_FLAG, false);
}

代码示例来源:origin: ECNU-1X/DataX-Masking

public HbaseAbstractTask(com.alibaba.datax.common.util.Configuration configuration) {
  //this.htable = Hbase11xHelper.getTable(configuration);
  this.bufferedMutator = Hbase11xHelper.getBufferedMutator(configuration);
  this.columns = configuration.getListConfiguration(Key.COLUMN);
  this.rowkeyColumn = configuration.getListConfiguration(Key.ROWKEY_COLUMN);
  this.versionColumn = configuration.getConfiguration(Key.VERSION_COLUMN);
  this.encoding = configuration.getString(Key.ENCODING,Constant.DEFAULT_ENCODING);
  this.nullMode = NullModeType.getByTypeName(configuration.getString(Key.NULL_MODE,Constant.DEFAULT_NULL_MODE));
  this.walFlag = configuration.getBool(Key.WAL_FLAG, false);
}

相关文章