Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dinky.shaded.paimon.options;
import org.dinky.shaded.paimon.annotation.Public;
import org.dinky.shaded.paimon.options.description.Description;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static org.dinky.shaded.paimon.utils.Preconditions.checkNotNull;
/**
* {@code ConfigOptions} are used to build a {@link ConfigOption}. The option is typically built in
* one of the following pattern:
*
*
{@code
* // simple string-valued option with a default value
* ConfigOption tempDirs = ConfigOptions
* .key("tmp.dir")
* .stringType()
* .defaultValue("/tmp");
*
* // simple integer-valued option with a default value
* ConfigOption parallelism = ConfigOptions
* .key("application.parallelism")
* .intType()
* .defaultValue(100);
*
* // option of list of integers with a default value
* ConfigOption parallelism = ConfigOptions
* .key("application.ports")
* .intType()
* .asList()
* .defaultValue(8000, 8001, 8002);
*
* // option with no default value
* ConfigOption userName = ConfigOptions
* .key("user.name")
* .stringType()
* .noDefaultValue();
*
* // option with deprecated keys to check
* ConfigOption threshold = ConfigOptions
* .key("cpu.utilization.threshold")
* .doubleType()
* .defaultValue(0.9)
* .withDeprecatedKeys("cpu.threshold");
* }
*
* @since 0.4.0
*/
@Public
public class ConfigOptions {
/**
* Starts building a new {@link ConfigOption}.
*
* @param key The key for the config option.
* @return The builder for the config option with the given key.
*/
public static OptionBuilder key(String key) {
checkNotNull(key);
return new OptionBuilder(key);
}
// ------------------------------------------------------------------------
/**
* The option builder is used to create a {@link ConfigOption}. It is instantiated via {@link
* ConfigOptions#key(String)}.
*/
public static final class OptionBuilder {
/**
* Workaround to reuse the {@link TypedConfigOptionBuilder} for a {@link Map Map<String,
* String>}.
*/
@SuppressWarnings("unchecked")
private static final Class