Package net.sf.gridarta.model.validation
This package contains the framework for validating maps.
Design Notes
Notes on not using a Mirror API
Although it would have been possible to create a Mirror API I have decided to directly hand out the original API to the map validation.Pro Mirror API / Contra Original API
- Keep the validation from (accidental) manipulation.
Pro Original API / Contra Mirror API
- The amount of work that a mirror API would have involved.
- Allow the validation to provide an error correction facility.
Notes on the class model
It would also have been possible to create less classes. But then the handling of enabling / disabling individual checks would have required more coding. I believe that this model is the best balance between an API that is powerful, small and easy to use. The number of classes is a bit high but all classes are extremely small.-
Interface Summary Interface Description ErrorCollector<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> An interface for classes that collect errors.GameObjectValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> Interface for GameObject Validators.MapValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> Interface for Map Validators.SquareValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> Interface for Square Validators.Validator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> Super-interface for validators.ValidatorPreferences Configuration parameters forValidators. -
Class Summary Class Description AbstractValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> This is the base class for validators.DefaultErrorCollector<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> Simple error collector that just collects the error in a collection for later retrieval through iteration.DefaultValidatorPreferences DefaultValidatorPreferencesimplementations.DelegatingMapValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> A Map Validator that delegates to other MapValidators.ValidationErrorComparator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> AComparatorthat comparesValidationErrorinstances for display ordering. -
Exception Summary Exception Description NoSuchValidatorException Exception thrown if a map validator cannot be created.