model/src/main/java/eu/internetofus/common/model/Model.java
/**
   * Obtain the model associated to a resource.
   *
   * @param resourceName where the model to obtain is defined In JSON.
   * @param type         of model to obtain
   * @param <T>          model to obtain
   *
   * @return the model defined on the resource or {@code null} if can not obtain
   *         it.
   */
Obtain the model associated to a resource.
@param resourceName where the model to obtain is defined In JSON.
@param type         of model to obtain
@param           model to obtain

@return the model defined on the resource or  null if can not obtain
it.
Obtain the model associated to a resource . @param resourceName where the model to obtain is defined In JSON . @param type of model to obtain @param model to obtain @return the model defined on the resource or null if can not obtain it .
public static <T extends Model> T loadFromResource(final String resourceName, final Class<T> type) {
    try {
      final var stream = type.getClassLoader().getResourceAsStream(resourceName);
      final var encoded = IOUtils.toString(stream, Charset.defaultCharset());
      return fromString(encoded, type);
    } catch (final Throwable throwable) {
      Logger.trace(throwable);
      return null;
    }
  }
public static < T extends Model > T loadFromResource ( final String resourceName , final Class < T > type ) { try { final var stream = type . getClassLoader ( ) . getResourceAsStream ( resourceName ) ; final var encoded = IOUtils . toString ( stream , Charset . defaultCharset ( ) ) ; return fromString ( encoded , type ) ; } catch ( final Throwable throwable ) { Logger . trace ( throwable ) ; return null ; } }
Obtain the model associated to a resource.
Obtain the model associated to a resource .