diff --git a/README.md b/README.md
index 498f0ae..283da40 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# feature-flag
+# option
-![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/KyoriPowered/feature-flag/build.yml?branch=trunk) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](license.txt) [![Maven Central](https://img.shields.io/maven-central/v/net.kyori/feature-flag?label=stable)](https://search.maven.org/search?q=g:net.kyori%20AND%20a:feature-flag) ![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/net.kyori/feature-flag?label=dev&server=https%3A%2F%2Fs01.oss.sonatype.org) [![Javadoc](https://img.shields.io/badge/javadoc-all-green)](https://jd.advntr.dev/)
+![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/KyoriPowered/option/build.yml?branch=trunk) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](license.txt) [![Maven Central](https://img.shields.io/maven-central/v/net.kyori/option?label=stable)](https://search.maven.org/search?q=g:net.kyori%20AND%20a:option) ![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/net.kyori/option?label=dev&server=https%3A%2F%2Fs01.oss.sonatype.org) [![Javadoc](https://img.shields.io/badge/javadoc-all-green)](https://jd.advntr.dev/)
A small library for handling version-based feature configuration.
@@ -10,6 +10,6 @@ We appreciate contributions of any type. For any new features or typo-fix/style
All the adventure projects are built with Gradle, require at least JDK 8, and use a common checkstyle configuration. Please make sure all tests pass, license headers are updated, and checkstyle passes to help us review your contribution.
-`feature-flag` is released under the terms of the [MIT License](license.txt).
+`option` is released under the terms of the [MIT License](license.txt).
[Discord]: https://discord.gg/MMfhJ8F
diff --git a/build.gradle.kts b/build.gradle.kts
index a9491f7..0c69a72 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -31,7 +31,7 @@ sourceSets {
main {
multirelease {
alternateVersions(9)
- moduleName("net.kyori.featureflag")
+ moduleName("net.kyori.option")
requireAllPackagesExported()
}
}
@@ -42,7 +42,7 @@ indraSonatype {
}
indra {
- github("KyoriPowered", "feature-flag") {
+ github("KyoriPowered", "option") {
ci(true)
}
mitLicense()
@@ -56,7 +56,7 @@ indra {
signWithKeyFromPrefixedProperties("kyori")
configurePublications {
pom {
- url = "https://feature-flag.kyori.net"
+ url = "https://option.kyori.net"
developers {
developer {
id = "kashike"
diff --git a/gradle.properties b/gradle.properties
index b9da59b..614e80c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
group=net.kyori
version=1.0.0-SNAPSHOT
-description=A small library for handling version-based feature configuration
+description=A small library for handling version-based option configuration
javadocPublishRoot=https://jd.advntr.dev/
diff --git a/license_header.txt b/license_header.txt
index 493c5cf..26f2b40 100644
--- a/license_header.txt
+++ b/license_header.txt
@@ -1,4 +1,4 @@
-This file is part of feature-flag, licensed under the MIT License.
+This file is part of option, licensed under the MIT License.
Copyright (c) $YEAR KyoriPowered
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 05d82b9..d876f1d 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -16,4 +16,4 @@ dependencyResolutionManagement {
}
}
-rootProject.name = "feature-flag"
+rootProject.name = "option"
diff --git a/src/main/java/net/kyori/featureflag/package-info.java b/src/main/java/net/kyori/featureflag/package-info.java
deleted file mode 100644
index bfd12d4..0000000
--- a/src/main/java/net/kyori/featureflag/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Feature flag system.
- */
-package net.kyori.featureflag;
diff --git a/src/main/java/net/kyori/featureflag/FeatureFlag.java b/src/main/java/net/kyori/option/Option.java
similarity index 72%
rename from src/main/java/net/kyori/featureflag/FeatureFlag.java
rename to src/main/java/net/kyori/option/Option.java
index 1a46503..6519fcc 100644
--- a/src/main/java/net/kyori/featureflag/FeatureFlag.java
+++ b/src/main/java/net/kyori/option/Option.java
@@ -1,5 +1,5 @@
/*
- * This file is part of feature-flag, licensed under the MIT License.
+ * This file is part of option, licensed under the MIT License.
*
* Copyright (c) 2023 KyoriPowered
*
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package net.kyori.featureflag;
+package net.kyori.option;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
- * A representation of a feature that can be toggled to one of several values.
+ * A representation of a configurable option.
*
*
Keys must be unique among all feature flag instances.
*
@@ -36,10 +36,10 @@
* @since 1.0.0
*/
@ApiStatus.NonExtendable
-public interface FeatureFlag {
+public interface Option {
/**
- * Create a feature flag with a boolean value type.
+ * Create an option with a boolean value type.
*
*
Flag keys must not be reused between flag instances.
*
@@ -48,12 +48,12 @@ public interface FeatureFlag {
* @return the flag instance
* @since 1.0.0
*/
- static FeatureFlag booleanFlag(final String id, final boolean defaultValue) {
- return FeatureFlagImpl.flag(id, Boolean.class, defaultValue);
+ static Option booleanOption(final String id, final boolean defaultValue) {
+ return OptionImpl.option(id, Boolean.class, defaultValue);
}
/**
- * Create a feature flag with an enum value type.
+ * Create an option with an enum value type.
*
*
Flag keys must not be reused between flag instances.
*
@@ -64,14 +64,14 @@ static FeatureFlag booleanFlag(final String id, final boolean defaultVa
* @return the flag instance
* @since 1.0.0
*/
- static > FeatureFlag enumFlag(final String id, final Class enumClazz, final E defaultValue) {
- return FeatureFlagImpl.flag(id, enumClazz, defaultValue);
+ static > Option enumOption(final String id, final Class enumClazz, final E defaultValue) {
+ return OptionImpl.option(id, enumClazz, defaultValue);
}
/**
- * Get the flag id.
+ * Get the option id.
*
- *
This must be unique among feature flags.
+ *
This must be unique among options.
*
* @return the flag id
* @since 1.0.0
@@ -79,7 +79,7 @@ static > FeatureFlag enumFlag(final String id, final Class<
@NotNull String id();
/**
- * Get the type of the flag value.
+ * Get the type of the option value.
*
* @return the value type
* @since 1.0.0
@@ -87,7 +87,7 @@ static > FeatureFlag enumFlag(final String id, final Class<
@NotNull Class type();
/**
- * Get a default value for the flag, if any is present.
+ * Get a default value for the option, if any is present.
*
* @return the default value
* @since 1.0.0
diff --git a/src/main/java/net/kyori/featureflag/FeatureFlagImpl.java b/src/main/java/net/kyori/option/OptionImpl.java
similarity index 82%
rename from src/main/java/net/kyori/featureflag/FeatureFlagImpl.java
rename to src/main/java/net/kyori/option/OptionImpl.java
index 4560600..2b3f493 100644
--- a/src/main/java/net/kyori/featureflag/FeatureFlagImpl.java
+++ b/src/main/java/net/kyori/option/OptionImpl.java
@@ -1,5 +1,5 @@
/*
- * This file is part of feature-flag, licensed under the MIT License.
+ * This file is part of option, licensed under the MIT License.
*
* Copyright (c) 2023 KyoriPowered
*
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package net.kyori.featureflag;
+package net.kyori.option;
import java.util.Objects;
import java.util.Set;
@@ -31,25 +31,25 @@
import static java.util.Objects.requireNonNull;
-final class FeatureFlagImpl implements FeatureFlag {
+final class OptionImpl implements Option {
private static final Set KNOWN_KEYS = ConcurrentHashMap.newKeySet();
private final String id;
private final Class type;
- private final @Nullable V defaultValue; // excluded from equality comparisons, it does not form part of the flag identity
+ private final @Nullable V defaultValue; // excluded from equality comparisons, it does not form part of the option identity
- FeatureFlagImpl(final @NotNull String id, final @NotNull Class type, final @Nullable V defaultValue) {
+ OptionImpl(final @NotNull String id, final @NotNull Class type, final @Nullable V defaultValue) {
this.id = id;
this.type = type;
this.defaultValue = defaultValue;
}
- static FeatureFlag flag(final String id, final Class type, final @Nullable T defaultValue) {
+ static Option option(final String id, final Class type, final @Nullable T defaultValue) {
if (!KNOWN_KEYS.add(id)) {
- throw new IllegalStateException("Key " + id + " has already been used. Feature flag keys must be unique.");
+ throw new IllegalStateException("Key " + id + " has already been used. Option keys must be unique.");
}
- return new FeatureFlagImpl<>(
+ return new OptionImpl<>(
requireNonNull(id, "id"),
requireNonNull(type, "type"),
defaultValue
@@ -75,7 +75,7 @@ static FeatureFlag flag(final String id, final Class type, final @Null
public boolean equals(final @Nullable Object other) {
if (this == other) return true;
if (other == null || getClass() != other.getClass()) return false;
- final FeatureFlagImpl> that = (FeatureFlagImpl>) other;
+ final OptionImpl> that = (OptionImpl>) other;
return Objects.equals(this.id, that.id)
&& Objects.equals(this.type, that.type);
}
diff --git a/src/main/java/net/kyori/featureflag/FeatureFlagConfig.java b/src/main/java/net/kyori/option/OptionState.java
similarity index 58%
rename from src/main/java/net/kyori/featureflag/FeatureFlagConfig.java
rename to src/main/java/net/kyori/option/OptionState.java
index 5656dd9..6fc2ba1 100644
--- a/src/main/java/net/kyori/featureflag/FeatureFlagConfig.java
+++ b/src/main/java/net/kyori/option/OptionState.java
@@ -1,5 +1,5 @@
/*
- * This file is part of feature-flag, licensed under the MIT License.
+ * This file is part of option, licensed under the MIT License.
*
* Copyright (c) 2023 KyoriPowered
*
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package net.kyori.featureflag;
+package net.kyori.option;
import java.util.Map;
import java.util.function.Consumer;
@@ -34,76 +34,76 @@
* @since 1.0.0
*/
@ApiStatus.NonExtendable
-public interface FeatureFlagConfig {
+public interface OptionState {
/**
- * Get an empty set of feature flags.
+ * Get an empty set of options.
*
- * @return the empty feature flag set
+ * @return the empty option state
* @since 1.0.0
*/
- static FeatureFlagConfig emptyFeatureFlagConfig() {
- return FeatureFlagConfigImpl.EMPTY;
+ static OptionState emptyOptionState() {
+ return OptionStateImpl.EMPTY;
}
/**
- * Create a builder for an unversioned feature flag set.
+ * Create a builder for an unversioned option state.
*
* @return the builder
* @since 1.0.0
*/
- static @NotNull Builder featureFlagConfig() {
- return new FeatureFlagConfigImpl.BuilderImpl();
+ static @NotNull Builder optionState() {
+ return new OptionStateImpl.BuilderImpl();
}
/**
- * Create a builder for a versioned feature flag set.
+ * Create a builder for a versioned option state.
*
* @return the builder
* @since 1.0.0
*/
- static @NotNull VersionedBuilder versionedFeatureFlagConfig() {
- return new FeatureFlagConfigImpl.VersionedBuilderImpl();
+ static @NotNull VersionedBuilder versionedOptionState() {
+ return new OptionStateImpl.VersionedBuilderImpl();
}
/**
- * Get whether a flag set contains a certain flag at all.
+ * Get whether this state contains a certain option at all.
*
- * @param flag the flag to check.
- * @return whether the flag has been touched.
+ * @param option the option to check.
+ * @return whether the option has been touched.
* @since 1.0.0
*/
- boolean has(final @NotNull FeatureFlag> flag);
+ boolean has(final @NotNull Option> option);
/**
- * Get the value set for a certain flag.
+ * Get the value set for a certain option.
*
- * @param flag the flag to query
- * @return the flag value
+ * @param option the option to query
+ * @return the option value
* @param the value type
* @since 1.0.0
*/
- V value(final @NotNull FeatureFlag flag);
+ V value(final @NotNull Option option);
/**
- * A composite feature flag set.
+ * A composite option set.
*
*
By default, this returns results for the newest supported version.
*
* @since 1.0.0
*/
@ApiStatus.NonExtendable
- interface Versioned extends FeatureFlagConfig {
+ interface Versioned extends OptionState {
/**
* The individual changes in each supported version.
*
* @return the child sets that exist
* @since 1.0.0
*/
- @NotNull Map childSets();
+ @NotNull Map childStates();
/**
- * Request a view of this feature flag set showing only flags available at versions up to and including {@code version}.
+ * Request a view of this option state showing only option values available at versions up to and including {@code version}.
*
* @param version the version to query
* @return a limited view of this set
@@ -113,62 +113,62 @@ interface Versioned extends FeatureFlagConfig {
}
/**
- * A builder for feature flag sets.
+ * A builder for option states.
*
* @since 1.0.0
*/
@ApiStatus.NonExtendable
interface Builder {
/**
- * Set the value for a specific flag.
+ * Set the value for a specific option.
*
- * @param flag the flag to set the value for
+ * @param option the option to set the value for
* @param value the value
* @return this builder
* @param the value type
* @since 1.0.0
*/
- @NotNull Builder value(final @NotNull FeatureFlag flag, final @NotNull V value);
+ @NotNull Builder value(final @NotNull Option option, final @NotNull V value);
/**
- * Apply all values from the existing feature flag set.
+ * Apply all values from the existing option state.
*
- * @param existing the existing set
+ * @param existing the existing state
* @return this builder
* @since 1.0.0
*/
- @NotNull Builder values(final @NotNull FeatureFlagConfig existing);
+ @NotNull Builder values(final @NotNull OptionState existing);
/**
- * Create a completed feature flag config.
+ * Create a completed option state.
*
- * @return the built config
+ * @return the built state
* @since 1.0.0
*/
- @NotNull FeatureFlagConfig build();
+ @NotNull OptionState build();
}
/**
- * A builder for versioned feature flag sets.
+ * A builder for versioned option states.
*
* @since 1.0.0
*/
@ApiStatus.NonExtendable
interface VersionedBuilder {
/**
- * Register feature flags for a specific version.
+ * Register options for a specific version.
*
* @param version the version to register
- * @param versionBuilder the builder that will receive flags
+ * @param versionBuilder the builder that will receive options
* @return this builder
* @since 1.0.0
*/
@NotNull VersionedBuilder version(final int version, final @NotNull Consumer versionBuilder);
/**
- * Create a completed versioned flag config.
+ * Create a completed versioned option state.
*
- * @return the built versioned config
+ * @return the built versioned state
* @since 1.0.0
*/
@NotNull Versioned build();
diff --git a/src/main/java/net/kyori/featureflag/FeatureFlagConfigImpl.java b/src/main/java/net/kyori/option/OptionStateImpl.java
similarity index 60%
rename from src/main/java/net/kyori/featureflag/FeatureFlagConfigImpl.java
rename to src/main/java/net/kyori/option/OptionStateImpl.java
index 9818110..c32d6d0 100644
--- a/src/main/java/net/kyori/featureflag/FeatureFlagConfigImpl.java
+++ b/src/main/java/net/kyori/option/OptionStateImpl.java
@@ -1,5 +1,5 @@
/*
- * This file is part of feature-flag, licensed under the MIT License.
+ * This file is part of option, licensed under the MIT License.
*
* Copyright (c) 2023 KyoriPowered
*
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package net.kyori.featureflag;
+package net.kyori.option;
import java.util.Collections;
import java.util.IdentityHashMap;
@@ -35,30 +35,30 @@
import static java.util.Objects.requireNonNull;
-final class FeatureFlagConfigImpl implements FeatureFlagConfig {
- static final FeatureFlagConfig EMPTY = new FeatureFlagConfigImpl(new IdentityHashMap<>());
- private final IdentityHashMap, Object> values;
+final class OptionStateImpl implements OptionState {
+ static final OptionState EMPTY = new OptionStateImpl(new IdentityHashMap<>());
+ private final IdentityHashMap