webforms – Does any one have an example of changing elements with AlterElements () in a webformHandler?

I have created a webformHandler (Drupal 8) and I want to edit some items before saving it.

I avoid using a hook just because I'm new to Drupal 8 and I want to focus on using classes and on a part of the habit to become familiar with the way things are happening in Drupal 8.

I have the configuration of the manager and everything seems to work fine, but I can not find the appropriate ways to modify an element in AlterElements (). There seems to be little information yet.

For the most part, all I'm going to do is change a simple value, but in the case of a field, I have to take an XML string that I've computed and save it to a file (it should be saved in the "private" file space). and then once I've got this file, I have to attach it to a file field that, I guess, will require a bit more work than the other simple values ​​I want to change.

The only other that could be tricky is a date field, but I guess it will be relatively simple. All others are just text. So there should be no problem once I have the basics to change a field in this function.

I could probably also do this in the preSave () function, which is also called when I press the send button and that I do not really have a preference, I just have to do it. open with AlterElements because it seems a little more specific to what I am. Make.