Record Class BasicConfigFile<K>

java.lang.Object
java.lang.Record
me.a8kj.config.file.impl.BasicConfigFile<K>
Type Parameters:
K - the type of data keys used in the configuration.
Record Components:
meta - the metadata defining the configuration's identity and behavior.
file - the physical file representation on the system.
memory - the data structure used for in-memory storage and manipulation. * @author a8kj7sea
All Implemented Interfaces:
ConfigFile<K>

public record BasicConfigFile<K>(ConfigMeta meta, File file, DataMemory<K> memory) extends Record implements ConfigFile<K>
A fundamental implementation of ConfigFile using Java Records. This record serves as an immutable container for configuration components, ensuring a consistent state between metadata, physical storage, and memory.
Since:
0.1
  • Constructor Details

    • BasicConfigFile

      public BasicConfigFile(ConfigMeta meta, File file, DataMemory<K> memory)
      Creates an instance of a BasicConfigFile record class.
      Parameters:
      meta - the value for the meta record component
      file - the value for the file record component
      memory - the value for the memory record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • meta

      public ConfigMeta meta()
      Returns the value of the meta record component.
      Specified by:
      meta in interface ConfigFile<K>
      Returns:
      the value of the meta record component
    • file

      public File file()
      Returns the value of the file record component.
      Specified by:
      file in interface ConfigFile<K>
      Returns:
      the value of the file record component
    • memory

      public DataMemory<K> memory()
      Returns the value of the memory record component.
      Specified by:
      memory in interface ConfigFile<K>
      Returns:
      the value of the memory record component