vertx/src/main/java/eu/internetofus/common/vertx/ModelResources.java
/**
   * Change an element of a field defined into a model.
   *
   * @param element            to merge.
   * @param getField           return the field value associated to a model.
   * @param context            of the request.
   * @param storerChangedModel function to store the changed model.
   * @param success            to inform to the upgrade value
   *
   * @param <T>                type of model that contains the fields.
   * @param <IT>               type of the model identifier.
   * @param <E>                type of the field.
   * @param <IE>               type of the field identifier.
   * @param <C>                type of validation context to use.
   */
Change an element of a field defined into a model.
@param element            to merge.
@param getField           return the field value associated to a model.
@param context            of the request.
@param storerChangedModel function to store the changed model.
@param success            to inform to the upgrade value

@param                 type of model that contains the fields.
@param                type of the model identifier.
@param                 type of the field.
@param                type of the field identifier.
@param                 type of validation context to use.
Change an element of a field defined into a model . @param element to merge . @param getField return the field value associated to a model . @param context of the request . @param storerChangedModel function to store the changed model . @param success to inform to the upgrade value @param type of model that contains the fields . @param type of the model identifier . @param type of the field . @param type of the field identifier . @param type of validation context to use .
static public <C extends ValidateContext<C>, T extends Model & Updateable<T, C>, IT, E extends Model, IE> void changeModelFieldElementAfterChain(
      @NotNull final ModelFieldContext<T, IT, E, IE, C> element, @NotNull final Function<T, List<E>> getField,
      final BiConsumer<T, Handler<AsyncResult<Void>>> storerChangedModel, @NotNull final ServiceContext context,
      @NotNull final Runnable success) {
    element.model.source = Model.fromBuffer(element.model.target.toBuffer(), element.model.type);
    final var sourceField = getField.apply(element.model.source);
    sourceField.remove(element.index);
    sourceField.add(element.index, element.value);
    update(element.model, context, true, () -> updateModelChain(element.model, storerChangedModel, context, success));
  }
static public < C extends ValidateContext < C > , T extends Model & Updateable < T , C > , IT , E extends Model , IE > void changeModelFieldElementAfterChain ( @ NotNull final ModelFieldContext < T , IT , E , IE , C > element , @ NotNull final Function < T , List < E > > getField , final BiConsumer < T , Handler < AsyncResult < Void > > > storerChangedModel , @ NotNull final ServiceContext context , @ NotNull final Runnable success ) { element . model . source = Model . fromBuffer ( element . model . target . toBuffer ( ) , element . model . type ) ; final var sourceField = getField . apply ( element . model . source ) ; sourceField . remove ( element . index ) ; sourceField . add ( element . index , element . value ) ; update ( element . model , context , true , ( ) -> updateModelChain ( element . model , storerChangedModel , context , success ) ) ; }
Change an element of a field defined into a model.
Change an element of a field defined into a model .