Record Class PklSettings

java.lang.Object
java.lang.Record
org.pkl.core.settings.PklSettings

public record PklSettings(PklSettings.Editor editor, PklEvaluatorSettings.Http http) extends Record
Java representation of a Pkl settings file. A Pkl settings file is a Pkl module amending the pkl.settings standard library module. To load a settings file, use one of the static load methods.
  • Constructor Details

    • PklSettings

      public PklSettings(PklSettings.Editor editor, @Nullable PklEvaluatorSettings.Http http)
      Creates an instance of a PklSettings record class.
      Parameters:
      editor - the value for the editor record component
      http - the value for the http record component
  • Method Details

    • loadFromPklHomeDir

      public static PklSettings loadFromPklHomeDir() throws VmEvalException
      Loads the user settings file (~/.pkl/settings.pkl). If this file does not exist, returns default settings defined by module pkl.settings.
      Throws:
      VmEvalException
    • load

      public static PklSettings load(ModuleSource moduleSource) throws VmEvalException
      Loads a settings file from the given path.
      Throws:
      VmEvalException
    • getEditor

      @Deprecated(forRemoval=true) public PklSettings.Editor getEditor()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the editor for viewing and editing Pkl files.

      This method is deprecated, use editor() instead.

    • 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.
    • editor

      public PklSettings.Editor editor()
      Returns the value of the editor record component.
      Returns:
      the value of the editor record component
    • http

      Returns the value of the http record component.
      Returns:
      the value of the http record component