Record Class MultilineString

java.lang.Object
java.lang.Record
net.flectone.pulse.model.value.MultilineString
Record Components:
lines - the lines, in the order they were written

public record MultilineString(List<String> lines) extends Record
A config value written either as a single line or as a list of lines.
  • Field Details

  • Constructor Details

    • MultilineString

      public MultilineString(List<String> lines)
      Creates an instance of a MultilineString record class.
      Parameters:
      lines - the value for the lines record component
  • Method Details

    • of

      public static MultilineString of(String value)
      Wraps a single line.
      Parameters:
      value - the text
      Returns:
      the value
    • fromJson

      public static MultilineString fromJson(Object object)
      Reads a value from its config representation, accepting both a single line and a list of them.
      Parameters:
      object - the raw config value
      Returns:
      the parsed value
    • value

      public String value()
      The lines joined with SEPARATOR.
      Returns:
      the text
    • join

      public String join(String separator)
      The lines joined with something else.
      Parameters:
      separator - what goes between two lines
      Returns:
      the text
    • toJson

      public Object toJson()
      Writes this value back to its config representation. List stays a list, single line stays a single line.
      Returns:
      the config value
    • toString

      public @NonNull 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.
    • lines

      public List<String> lines()
      Returns the value of the lines record component.
      Returns:
      the value of the lines record component