I am considering two options for passing the result of the validation to the polymer element.
- A bool function with a FormatException for the error message.
- Add validation to the setter.
- Or return a CustomEvent with a Map of the result and message.
In the setter
The object is more protected if the validation is in the setter. Defining the setter with validation requires creating a private field and removing the @observable status from the field; Observables can have setters or getters.
Is it worth it?
Implementing the validator in the model class has complicated the code. Is having a more robust class worth it?
No comments:
Post a Comment