Package net.sf.gridarta.model.validation
Class DelegatingMapValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.model.validation.AbstractValidator<G,A,R>
-
- net.sf.gridarta.model.validation.DelegatingMapValidator<G,A,R>
-
- All Implemented Interfaces:
java.lang.Iterable<Validator<G,A,R>>,GameObjectValidator<G,A,R>,MapValidator<G,A,R>,SquareValidator<G,A,R>,Validator<G,A,R>
public class DelegatingMapValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends AbstractValidator<G,A,R> implements GameObjectValidator<G,A,R>, SquareValidator<G,A,R>, MapValidator<G,A,R>, java.lang.Iterable<Validator<G,A,R>>
A Map Validator that delegates to other MapValidators.
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.StringDEFAULT_KEYThe default key.
-
Constructor Summary
Constructors Constructor Description DelegatingMapValidator(@NotNull ValidatorPreferences validatorPreferences)Creates a new instance for the default key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValidator(@NotNull Validator<G,A,R> validator)Adds aValidatorthat might to be queried.@NotNull java.util.Iterator<Validator<G,A,R>>iterator()voidvalidateAll(@NotNull MapModel<G,A,R> mapModel)Performs all validations on a map.voidvalidateGameObject(G gameObject, @NotNull ErrorCollector<G,A,R> errorCollector)Validates a game object.voidvalidateMap(@NotNull MapModel<G,A,R> mapModel, @NotNull ErrorCollector<G,A,R> errorCollector)Validate a map.voidvalidateSquare(@NotNull MapSquare<G,A,R> mapSquare, @NotNull ErrorCollector<G,A,R> errorCollector)Validate a map square.-
Methods inherited from class net.sf.gridarta.model.validation.AbstractValidator
getKey, isDefaultEnabled, isEnabled, setEnabled
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.gridarta.model.validation.Validator
getKey, isDefaultEnabled, isEnabled, setEnabled
-
-
-
-
Field Detail
-
DEFAULT_KEY
@NotNull public static final @NotNull java.lang.String DEFAULT_KEY
The default key.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DelegatingMapValidator
public DelegatingMapValidator(@NotNull @NotNull ValidatorPreferences validatorPreferences)Creates a new instance for the default key.- Parameters:
validatorPreferences- the validator preferences to use
-
-
Method Detail
-
validateAll
public void validateAll(@NotNull @NotNull MapModel<G,A,R> mapModel)Performs all validations on a map.- Parameters:
mapModel- map to validate
-
validateMap
public void validateMap(@NotNull @NotNull MapModel<G,A,R> mapModel, @NotNull @NotNull ErrorCollector<G,A,R> errorCollector)Description copied from interface:MapValidatorValidate a map.- Specified by:
validateMapin interfaceMapValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
mapModel- Map to validateerrorCollector- Error collector to report errors to
-
validateSquare
public void validateSquare(@NotNull @NotNull MapSquare<G,A,R> mapSquare, @NotNull @NotNull ErrorCollector<G,A,R> errorCollector)Description copied from interface:SquareValidatorValidate a map square.- Specified by:
validateSquarein interfaceSquareValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
mapSquare- Square to validateerrorCollector- Error collector to report errors to
-
validateGameObject
public void validateGameObject(@NotNull G gameObject, @NotNull @NotNull ErrorCollector<G,A,R> errorCollector)Description copied from interface:GameObjectValidatorValidates a game object.- Specified by:
validateGameObjectin interfaceGameObjectValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
gameObject- the game object to validateerrorCollector- the error collector to report errors to
-
addValidator
public void addValidator(@NotNull @NotNull Validator<G,A,R> validator)Adds aValidatorthat might to be queried. The validator is queried for a KeyName and the preferences are queried whether this validator module should or shouldn't be active.- Parameters:
validator- to be queried
-
-