Class ConfiguredValue<V>


public class ConfiguredValue<V> extends CachedConfigValue<V,V>
  • Field Details

    • adapter

      @NotNull protected final @NotNull ValueAdapter<V> adapter
  • Constructor Details

  • Method Details

    • builderOf

      public static <V> ConfigValueBuilder<V> builderOf(@NotNull @NotNull Class<V> type)
      Create a new value builder.
      Type Parameters:
      V - The type of the value.
      Parameters:
      type - The type of the value.
      Returns:
      a ConfigValueBuilder with the specified type.
    • builderOf

      public static <V> ConfigValueBuilder<V> builderOf(@NotNull @NotNull ValueType<V> type)
      Create a new value builder.
      Type Parameters:
      V - The type of the value.
      Parameters:
      type - The type of the value.
      Returns:
      a ConfigValueBuilder with the specified type.
    • with

      public static <V> SourceValueBuilder<V,V> with(@NotNull @NotNull Class<V> registeredType)
      Create a new value builder with the specified ConfigurationHolder.registeredValues() type.
      Type Parameters:
      V - The type of the value.
      Parameters:
      registeredType - The type of the value.
      Returns:
      a SourceValueBuilder with the specified registered type.
      See Also:
    • with

      public static <V> SourceValueBuilder<V,V> with(@NotNull @NotNull ValueType<V> registeredType)
      Create a new value builder with the specified ConfigurationHolder.registeredValues() type.
      Type Parameters:
      V - The type of the value.
      Parameters:
      registeredType - The type of the value.
      Returns:
      a SourceValueBuilder with the specified registered type.
      See Also:
    • of

      public static <V> ConfiguredValue<V> of(@NotNull V defaults)
    • of

      public static <V> ConfiguredValue<V> of(@NotNull @NotNull Class<V> type)
    • of

      public static <V> ConfiguredValue<V> of(@NotNull @NotNull Class<V> type, @NotNull V defaults)
    • of

      public static <V> ConfiguredValue<V> of(@NotNull @NotNull Class<V> type, @NotNull @NotNull Supplier<@Nullable V> defaultSupplier)
    • of

      public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueType<V> type)
    • of

      public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueType<V> type, @NotNull @NotNull Supplier<@Nullable V> defaultSupplier)
    • of

      public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueManifest<V,V> manifest, @Nullable @Nullable ValueParser<V> parser, @Nullable @Nullable ValueSerializer<V> serializer)
    • of

      public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueManifest<V,V> manifest, @NotNull @NotNull ValueAdapter<V> adapter)
    • adapter

      @NotNull public @NotNull ValueAdapter<V> adapter()
      Returns:
      Adapter of this value.
    • parser

      @Nullable public @Nullable ValueParser<V> parser()
      Returns:
      Value's parser, parse base object to value.
    • serializer

      @Nullable public @Nullable ValueSerializer<V> serializer()
      Returns:
      Value's serializer, parse value to base object.
    • get

      public V get()
      Description copied from class: ConfigValue
      Gets the configured value (i.e., the value read from the source).
      If no default value was written during initialization, you can use the ConfigValue.getOrDefault() method to obtain the default value when this value is empty.
      Specified by:
      get in class ConfigValue<V,V>
      Returns:
      Configured value
    • set

      public void set(@Nullable V value)
      Set the value of the configuration path. Will use serializer() to serialize the value.
      Specified by:
      set in class ConfigValue<V,V>
      Parameters:
      value - The value to be set