java.lang.Object
com.mrivanplays.annotationconfig.core.resolver.settings.Settings

public final class Settings extends Object
Represents a Setting holder.
Since:
3.0.0
Author:
MrIvanPlays
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    combine(Settings settings)
    Combines the specified Settings with this Settings instance.
    Creates a mutable copy of the current settings object.
    copy(boolean immutable)
    Creates a copy of the current settings object.
    boolean
     
    <T> Optional<T>
    get(Setting<T> setting)
    Get the stored value in these settings of the specified Setting, if any.
    boolean
    has(Setting<?> setting)
    Checks whether this settings instance stores a value for this setting
    int
     
    boolean
    Returns whether this settings instance is immutable.
    put(Setting<T> setting, T value)
    Puts the specified Setting setting value into this settings instance, or if it already exists it replaces it.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • copy

      public Settings copy()
      Creates a mutable copy of the current settings object.
      Returns:
      copy
    • copy

      public Settings copy(boolean immutable)
      Creates a copy of the current settings object.
      Parameters:
      immutable - whether the copy to be immutable
      Returns:
      copy
    • has

      public boolean has(Setting<?> setting)
      Checks whether this settings instance stores a value for this setting
      Parameters:
      setting - setting
      Returns:
      whether it has value or not
    • immutable

      public boolean immutable()
      Returns whether this settings instance is immutable.
      Returns:
      immutable or not
    • put

      public <T> Settings put(Setting<T> setting, T value)
      Puts the specified Setting setting value into this settings instance, or if it already exists it replaces it.
      Type Parameters:
      T - value type
      Parameters:
      setting - setting to modify
      value - value to put/replace
      Returns:
      this settings instance for chaining
      Throws:
      IllegalArgumentException - when the setting key is occupied by another value data type
    • combine

      public Settings combine(Settings settings)
      Combines the specified Settings with this Settings instance. If a setting, that is present in the specified settings, is also present in this settings instance, then the value of this settings instance is respected.
      Parameters:
      settings - settings to combine with
      Returns:
      this instance for chaining
    • get

      public <T> Optional<T> get(Setting<T> setting)
      Get the stored value in these settings of the specified Setting, if any.
      Type Parameters:
      T - value type
      Parameters:
      setting - the setting needed to get
      Returns:
      empty optional or optional fulfilled with value
      Throws:
      IllegalArgumentException - if the submitted setting's type mismatches the setting type held.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object