model/src/main/java/eu/internetofus/common/model/Model.java
/**
   * Obtain the model associated to a future {@link JsonObject}.
   *
   * @param futureObject the future object of the model.
   * @param type         of model to obtain.
   *
   * @param <T>          type of model.
   *
   * @return the future model defined on the object.
   */
Obtain the model associated to a future  JsonObject.
@param futureObject the future object of the model.
@param type         of model to obtain.

@param           type of model.

@return the future model defined on the object.
Obtain the model associated to a future JsonObject . @param futureObject the future object of the model . @param type of model to obtain . @param type of model . @return the future model defined on the object .
public static <T extends Model> Future<T> fromFutureJsonObject(@NotNull final Future<JsonObject> futureObject,
      @NotNull final Class<T> type) {
    return futureObject.compose(object -> {
      if (object == null) {
        return Future.failedFuture("No object to get the value");
      } else {
        try {
          final var value = Json.decodeValue(object.toBuffer(), type);
          return Future.succeededFuture(value);
        } catch (final Throwable throwable) {
          return Future.failedFuture(throwable);
        }
      }
    });
  }
public static < T extends Model > Future < T > fromFutureJsonObject ( @ NotNull final Future < JsonObject > futureObject , @ NotNull final Class < T > type ) { return futureObject . compose ( object -> { if ( object == null ) { return Future . failedFuture ( "No object to get the value" ) ; } else { try { final var value = Json . decodeValue ( object . toBuffer ( ) , type ) ; return Future . succeededFuture ( value ) ; } catch ( final Throwable throwable ) { return Future . failedFuture ( throwable ) ; } } } ) ; }
Obtain the model associated to a future {@link JsonObject}.
Obtain the model associated to a future { @link JsonObject } .