Record Class WebConfig

java.lang.Object
java.lang.Record
net.simplace.sim.wrapper.web.WebConfig
Record Components:
user - login name
password - login password

public record WebConfig(String user, String password) extends Record
Settings of the web client, read from its properties file (web.properties, see web.properties.template next to WebServer). Keys:
  • web.user, web.password - login of the browser (Basic-Auth); both required
The web client does not start without them: whoever can log in can run solutions and download the files they write.
Author:
Andreas Enders, Claude (Anthropic), co-author
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Properties file read if no other is given, in the working directory of the process.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WebConfig(String user, String password)
    Creates an instance of a WebConfig record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static WebConfig
    load(File aFile)
    Reads the settings.
    Returns the value of the password record component.
    Returns a string representation of this record class.
    Returns the value of the user record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_FILE

      public static final String DEFAULT_FILE
      Properties file read if no other is given, in the working directory of the process.
      See Also:
  • Constructor Details

    • WebConfig

      public WebConfig(String user, String password)
      Creates an instance of a WebConfig record class.
      Parameters:
      user - the value for the user record component
      password - the value for the password record component
  • Method Details

    • load

      public static WebConfig load(File aFile) throws IOException
      Reads the settings. The file is read as UTF-8 (a byte order mark is skipped).
      Parameters:
      aFile - the properties file
      Returns:
      the settings
      Throws:
      IOException - if the file cannot be read
      IllegalStateException - if the file is missing or user or password are not set
    • toString

      public 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.
    • user

      public String user()
      Returns the value of the user record component.
      Returns:
      the value of the user record component
    • password

      public String password()
      Returns the value of the password record component.
      Returns:
      the value of the password record component