static Params createFromConfig(Config config) { if (config.hasPath(NEWEST_K_VERSIONS_SELECTED_KEY)) { if (config.hasPath(NEWEST_K_VERSIONS_NOTSELECTED_KEY)) { throw new RuntimeException("Only one of " + NEWEST_K_VERSIONS_SELECTED_KEY + " and " + NEWEST_K_VERSIONS_NOTSELECTED_KEY + " can be specified."); } return new Params(config.getInt(NEWEST_K_VERSIONS_SELECTED_KEY), false); } else if (config.hasPath(NEWEST_K_VERSIONS_NOTSELECTED_KEY)) { return new Params(config.getInt(NEWEST_K_VERSIONS_NOTSELECTED_KEY), true); } else { return new Params(VERSIONS_SELECTED_DEFAULT, false); } }
@VisibleForTesting int getVersionsSelected() { return this.params.getVersionsSelected(); }
@VisibleForTesting boolean isExcludeMode() { return this.params.isExcludeMode(); } }
public NewestKSelectionPolicy(Properties props) { this(Params.createFromProps(props)); }
static Params createFromProps(Properties props) { return createFromConfig(ConfigFactory.parseProperties(props)); } }
static Params createFromConfig(Config config) { if (config.hasPath(NEWEST_K_VERSIONS_SELECTED_KEY)) { if (config.hasPath(NEWEST_K_VERSIONS_NOTSELECTED_KEY)) { throw new RuntimeException("Only one of " + NEWEST_K_VERSIONS_SELECTED_KEY + " and " + NEWEST_K_VERSIONS_NOTSELECTED_KEY + " can be specified."); } return new Params(config.getInt(NEWEST_K_VERSIONS_SELECTED_KEY), false); } else if (config.hasPath(NEWEST_K_VERSIONS_NOTSELECTED_KEY)) { return new Params(config.getInt(NEWEST_K_VERSIONS_NOTSELECTED_KEY), true); } else { return new Params(VERSIONS_SELECTED_DEFAULT, false); } }
public NewestKSelectionPolicy(Config config) { this(Params.createFromConfig(config)); }
public NewestKSelectionPolicy(int versionsRetained, boolean excludeMode) { this(new Params(versionsRetained, excludeMode)); }
@VisibleForTesting int getVersionsSelected() { return this.params.getVersionsSelected(); }
@VisibleForTesting boolean isExcludeMode() { return this.params.isExcludeMode(); } }
public NewestKSelectionPolicy(Config config) { this(Params.createFromConfig(config)); }
public NewestKSelectionPolicy(Properties props) { this(Params.createFromProps(props)); }
public NewestKSelectionPolicy(int versionsRetained, boolean excludeMode) { this(new Params(versionsRetained, excludeMode)); }
static Params createFromProps(Properties props) { return createFromConfig(ConfigFactory.parseProperties(props)); } }