Record Class LifePathIO.LifePathLoadResult

java.lang.Object
java.lang.Record
mekhq.campaign.personnel.advancedCharacterBuilder.LifePathIO.LifePathLoadResult
Record Components:
lifePath - the Life Path that was read, or null when nothing was read
errorMessage - why the read failed, or null when it did not fail
fileHasLegalStatement - whether the file carried the MegaMek Data licence header, so the wizard can show the checkbox the way the file actually is rather than however it was last left
Enclosing class:
LifePathIO

public static record LifePathIO.LifePathLoadResult(@Nullable LifePath lifePath, @Nullable String errorMessage, boolean fileHasLegalStatement) extends Record
The outcome of asking the user to open a Life Path file.

A failed read used to be swallowed, so picking a bad file did nothing visible. Returning the reason lets the caller tell the user what went wrong.

Since:
0.50.11
  • Constructor Details

    • LifePathLoadResult

      public LifePathLoadResult(@Nullable LifePath lifePath, @Nullable String errorMessage, boolean fileHasLegalStatement)
      Creates an instance of a LifePathLoadResult record class.
      Parameters:
      lifePath - the value for the lifePath record component
      errorMessage - the value for the errorMessage record component
      fileHasLegalStatement - the value for the fileHasLegalStatement record component
  • Method Details

    • isLoaded

      public boolean isLoaded()
      Returns:
      true when a Life Path was read
    • isFailed

      public boolean isFailed()
      Returns:
      true when the user picked a file that could not be read
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • lifePath

      @Nullable public LifePath lifePath()
      Returns the value of the lifePath record component.
      Returns:
      the value of the lifePath record component
    • errorMessage

      @Nullable public String errorMessage()
      Returns the value of the errorMessage record component.
      Returns:
      the value of the errorMessage record component
    • fileHasLegalStatement

      public boolean fileHasLegalStatement()
      Returns the value of the fileHasLegalStatement record component.
      Returns:
      the value of the fileHasLegalStatement record component