Class LifePathValidator
The record constructor rejects values that make a Life Path unloadable, such as a null map or a negative XP cost. This class covers the next layer up: a path that loads perfectly well but cannot work, such as an affiliation stage with no faction attached, or more flexible picks than there are groups to pick from.
There are two entry points because validation happens at two moments. validate(LifePath) checks a
finished record and is used when files are read from disk. validate(LifePathBuilder) checks the wizard's
working state, which has to be validated before a record is built, because the record's constructor would
throw first and the author would see a stack trace instead of a list of problems.
- Since:
- 0.50.11
-
Method Summary
Modifier and TypeMethodDescriptionReturns every problem found with the Life Path that was validated.static Set<InvalidLifePathReason> Validates a finishedLifePath.static Set<InvalidLifePathReason> validate(LifePathBuilder lifePath) Validates a Life Path that is still being assembled.
-
Method Details
-
getInvalidReasons
Returns every problem found with the Life Path that was validated.- Returns:
- the reasons this Life Path is invalid, empty when it is valid
- Since:
- 0.50.11
-
validate
Validates a finishedLifePath.Use this for records that already exist, such as the files read at campaign load. A record that reaches this method has already satisfied its own constructor, so anything reported here is an authoring mistake rather than a corrupt file.
- Parameters:
lifePath- the Life Path to check- Returns:
- the reasons it is invalid, empty when it is valid
- Since:
- 0.50.11
-
validate
Validates a Life Path that is still being assembled.This is what the wizard uses. It cannot hand over a
LifePath, because the record's constructor throws on the very values this check exists to report, and the author would see a stack trace instead of a list of things to fix.- Parameters:
lifePath- the Life Path under construction- Returns:
- the reasons it is invalid, empty when it is valid
- Since:
- 0.50.11
-