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, ornullwhen nothing was readerrorMessage- why the read failed, ornullwhen it did not failfileHasLegalStatement- 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 Summary
ConstructorsConstructorDescriptionLifePathLoadResult(LifePath lifePath, String errorMessage, boolean fileHasLegalStatement) Creates an instance of aLifePathLoadResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorMessagerecord component.booleanReturns the value of thefileHasLegalStatementrecord component.final inthashCode()Returns a hash code value for this object.booleanisFailed()booleanisLoaded()lifePath()Returns the value of thelifePathrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LifePathLoadResult
public LifePathLoadResult(@Nullable LifePath lifePath, @Nullable String errorMessage, boolean fileHasLegalStatement) Creates an instance of aLifePathLoadResultrecord class.- Parameters:
lifePath- the value for thelifePathrecord componenterrorMessage- the value for theerrorMessagerecord componentfileHasLegalStatement- the value for thefileHasLegalStatementrecord component
-
-
Method Details
-
isLoaded
public boolean isLoaded()- Returns:
truewhen a Life Path was read
-
isFailed
public boolean isFailed()- Returns:
truewhen the user picked a file that could not be read
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
lifePath
Returns the value of thelifePathrecord component.- Returns:
- the value of the
lifePathrecord component
-
errorMessage
Returns the value of theerrorMessagerecord component.- Returns:
- the value of the
errorMessagerecord component
-
fileHasLegalStatement
public boolean fileHasLegalStatement()Returns the value of thefileHasLegalStatementrecord component.- Returns:
- the value of the
fileHasLegalStatementrecord component
-