Class ChoiceValidator
java.lang.Object
com.csse3200.game.cutscene.validators.actionvalidators.ChoiceValidator
- All Implemented Interfaces:
ActionValidator
Implements the
ActionValidator
interface for concrete implementation of the
validate
method.
Validates choice events against the following conditions:
prompt
must be a stringchoices
must be a list- Each element of
choices
must be a map - Each entry in each choice map must have a
String
key andString
value - No key or value can be empty or null
- The choice field
entryBeatId
must be a valid beat id (only checked for"current"
cutsceneId
) - Each choice map must contain the following keys:
type
line
cutsceneId
entryBeatId
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvalidate
(String beatId, ActionDTO action, ValidationCtx context) Validate an action against a set of rules defined for each type of action.
-
Constructor Details
-
ChoiceValidator
public ChoiceValidator()
-
-
Method Details
-
validate
Validate an action against a set of rules defined for each type of action.- Specified by:
validate
in interfaceActionValidator
- Parameters:
beatId
- The id of the beat having one of its actions validatedaction
- TheActionDTO
being validatedcontext
- TheValidationCtx
with the document context- Returns:
- A list of
AuthoringError
for each rule infraction
-