org.datacleaner.api.Validate类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(110)

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

Validate介绍

暂无

代码示例

代码示例来源:origin: org.eobjects.datacleaner/DataCleaner-monitor-services

@Validate
public void validate() {
  if (count < 0) {
    throw new IllegalStateException("Count cannot be negative");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (compareColumn == null && compareValue == null) {
    throw new IllegalStateException("Either 'Compare value' or 'Compare column' needs to be specified.");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (conditionValues.length != conditionColumnNames.length) {
    throw new IllegalStateException("Condition values and condition column names should have equal length");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (values.length != columnNames.length) {
    throw new IllegalStateException(
        "Length of 'Values' (" + values.length + ") and 'Column names' (" + columnNames.length
            + ") must be equal");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (compareColumn == null) {
    if (compareValues == null || compareValues.length == 0) {
      throw new IllegalStateException("Either 'Values' or 'Value column' needs to be specified.");
    }
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (lowestValue.compareTo(highestValue) > 0) {
    throw new IllegalStateException("Lowest value is greater than the highest value");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (values.length != columnNames.length) {
    throw new IllegalStateException("Values and column names should have equal length");
  }
  if (conditionValues.length != conditionColumnNames.length) {
    throw new IllegalStateException("Condition values and condition column names should have equal length");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (maxRows <= 0) {
    throw new IllegalStateException("Max rows value must be a positive integer");
  }
  if (firstRow <= 0) {
    throw new IllegalStateException("First row value must be a positive integer");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  try {
    TimeZone.getTimeZone(timeZone);
  } catch (final Exception e) {
    throw new IllegalStateException("Time zone '" + timeZone + "' not recognized.");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public final void validateFieldNames() {
  if (fields != null) {
    final Set<String> uniqueFieldNames = new HashSet<>();
    for (final String fieldName : fields) {
      final String normalizedFieldName = fieldName.trim().toLowerCase();
      final boolean added = uniqueFieldNames.add(normalizedFieldName);
      if (!added) {
        throw new IllegalStateException("Field names must be unique. Field name '" + normalizedFieldName
            + "' occurs multiple times.");
      }
    }
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  for (final CoalesceUnit unit : _units) {
    // Ensure that initialization is actually possible.
    unit.updateInputColumns(_input);
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  for (final Entry<String, String> entry : replacements.entrySet()) {
    final String searchString = entry.getKey();
    if (Strings.isNullOrEmpty(searchString)) {
      throw new IllegalArgumentException("Search string cannot be empty");
    }
    final String replacementString = entry.getValue();
    if (!replaceEntireString && replacementString.indexOf(searchString) != -1) {
      throw new IllegalArgumentException(
          "Replacement string cannot contain the search string (implies an infinite replacement loop)");
    }
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (!overwriteFileIfExists && file.isExists()) {
    throw new IllegalStateException(
        "The file already exists. Please configure the job to overwrite the existing file.");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (isCarthesianProductMode()) {
    // carthesian product mode
    return;
  }
  final Column[] queryConditionColumns = getQueryConditionColumns();
  final List<String> columnsNotFound = new ArrayList<>();
  for (int i = 0; i < queryConditionColumns.length; i++) {
    if (queryConditionColumns[i] == null) {
      columnsNotFound.add(conditionColumns[i]);
    }
  }
  if (!columnsNotFound.isEmpty()) {
    throw new IllegalArgumentException("Could not find column(s): " + columnsNotFound);
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (!_hasBeenValidated) {
    Assert.assertNull("Spec defines that initializeOutputDataStream(...) is not called before validation time",
        collector1);
    Assert.assertNull("Spec defines that initializeOutputDataStream(...) is not called before validation time",
        collector2);
  }
  _hasBeenValidated = true;
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (compare(getLowestValue(), getHighestValue()) > 0) {
    throw new IllegalStateException("Lowest value is greater than the highest value");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  if (!isDictionaryMatchingEnabled() && !isSynonymCatalogLookupEnabled() && !isStringPatternMatchingEnabled()) {
    throw new IllegalStateException("No dictionaries, synonym catalogs or string patterns selected");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
  public void validate() {
    // The first time this method is invoked, the datastoreCatalog and
    // userPreferences fields haven't been populated yet, therefore we just
    // skip the check, because it is called a little bit later again, and
    // then these fields are populated.
    if (datastoreCatalog != null) {
      // Validate that the datastoreName doesn't conflict with one of the
      // datastores in the datastoreCatalog.
      final Datastore datastore = datastoreCatalog.getDatastore(datastoreName);

      if (datastore != null) {
        if (datastore instanceof JdbcDatastore && ((JdbcDatastore) datastore).getDriverClass()
            .equals(H2_DRIVER_CLASS_NAME)) {
          if (!((JdbcDatastore) datastore).getJdbcUrl().startsWith(
              H2_DATABASE_CONNECTION_PROTOCOL + userPreferences.getSaveDatastoreDirectory().getPath())) {
            throw new IllegalStateException("Datastore \"" + datastoreName
                + "\" is not located in \"Written datastores\" directory \"" + userPreferences
                .getSaveDatastoreDirectory().getPath() + "\".");
          }
        } else {
          throw new IllegalStateException("Datastore \"" + datastoreName
              + "\" is not an H2 database, so it can't be used as a staging database.");
        }
      }
    }
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  sheetName = sheetName.trim();
  if (sheetName.length() > SHEET_NAME_MAX_LENGTH) {
    throw new IllegalStateException("Sheet name must be maximum " + SHEET_NAME_MAX_LENGTH + " characters long");
  }
  for (final char c : SHEET_NAME_ILLEGAL_CHARS) {
    if (sheetName.indexOf(c) != -1) {
      throw new IllegalStateException("Sheet name cannot contain '" + c + "'");
    }
  }
  if (!overwriteSheetIfExists && file.exists()) {
    final Datastore datastore =
        new ExcelDatastore(file.getName(), new FileResource(file), file.getAbsolutePath());
    try (DatastoreConnection connection = datastore.openConnection()) {
      final List<String> tableNames = connection.getDataContext().getDefaultSchema().getTableNames();
      for (String tableName : tableNames) {
        if (tableName.equals(sheetName)) {
          throw new IllegalStateException(
              "The sheet '" + sheetName + "' already exists. Please select another sheet name.");
        }
      }
    }
  }
  if (!FilenameUtils.isExtension(file.getName(), excelExtension)) {
    throw new IllegalStateException("Please add the '.xlsx'  or '.xls' extension to the filename");
  }
}

代码示例来源:origin: datacleaner/DataCleaner

@Validate
public void validate() {
  validateDictionaries(allWordsDictionaries);
  validateDictionaries(wordDictionaries);
  validateDictionaries(wordStartDictionaries);
  validateDictionaries(wordEndDictionaries);
}

相关文章

微信公众号

最新文章

更多

Validate类方法