Class AdvancedConfigPath<F,T>

java.lang.Object
me.hsgamer.hscore.config.path.AdvancedConfigPath<F,T>
Type Parameters:
F - the type of the raw value from the config
T - the type of the final value
All Implemented Interfaces:
ConfigPath<T>
Direct Known Subclasses:
SerializableMapConfigPath

public abstract class AdvancedConfigPath<F,T> extends Object implements ConfigPath<T>
An advanced config path
  • Constructor Details

    • AdvancedConfigPath

      public AdvancedConfigPath(@NotNull @NotNull String path, @Nullable T def)
      Create a config path
      Parameters:
      path - the path to the value
      def - the default value if it's not found
  • Method Details

    • getFromConfig

      @Nullable public abstract F getFromConfig(@NotNull @NotNull Config config)
      Get the raw value from the config
      Parameters:
      config - the config
      Returns:
      the raw value
    • convert

      @Nullable public abstract T convert(@NotNull F rawValue)
      Convert to the final value
      Parameters:
      rawValue - the raw value
      Returns:
      the final value
    • convertToRaw

      @Nullable public abstract F convertToRaw(@NotNull T value)
      Convert to the raw value
      Parameters:
      value - the value
      Returns:
      the raw value
    • getValue

      public T getValue()
      Description copied from interface: ConfigPath
      Get the value
      Specified by:
      getValue in interface ConfigPath<F>
      Returns:
      the value
    • setValue

      public void setValue(@Nullable T value)
      Description copied from interface: ConfigPath
      Set the value
      Specified by:
      setValue in interface ConfigPath<F>
      Parameters:
      value - the value
    • getValue

      public T getValue(@NotNull @NotNull Config config)
      Description copied from interface: ConfigPath
      Get the value from the config. This is used to get the value from multiple configs.
      Specified by:
      getValue in interface ConfigPath<F>
      Parameters:
      config - the config
      Returns:
      the value
    • setValue

      public void setValue(@Nullable T value, @NotNull @NotNull Config config)
      Description copied from interface: ConfigPath
      Set the value to the config. This is used to set the value to multiple configs.
      Specified by:
      setValue in interface ConfigPath<F>
      Parameters:
      value - the value
      config - the config
    • getPath

      @NotNull public @NotNull String getPath()
      Description copied from interface: ConfigPath
      Get the path to the value
      Specified by:
      getPath in interface ConfigPath<F>
      Returns:
      the path
    • getConfig

      @Nullable public @Nullable Config getConfig()
      Description copied from interface: ConfigPath
      Get the config
      Specified by:
      getConfig in interface ConfigPath<F>
      Returns:
      the config
    • setConfig

      public void setConfig(@NotNull @NotNull Config config)
      Description copied from interface: ConfigPath
      Set the config.
      Specified by:
      setConfig in interface ConfigPath<F>
      Parameters:
      config - the config
    • migrateConfig

      public void migrateConfig(@NotNull @NotNull Config config)
      Description copied from interface: ConfigPath
      Manually update the config (Mainly used when updating new settings)
      Specified by:
      migrateConfig in interface ConfigPath<F>
      Parameters:
      config - the config