Skip to content

v2.0.0

Compare
Choose a tag to compare
@JoseLion JoseLion released this 01 Mar 19:01
de65a40

This major release brings some breaking changes and some exciting new features. Most breaking changes are caused by the renaming of methods in the API since this new version aims to make the API similar to Java's Optional<T>. This way, developers will have an easier time remembering the API, plus providing better consistency across their code.

Breaking changes

  • Checked functional interfaces methods should have matching names as their non-checked counterparts to allow interoperability with other APIs
  • Rename Maybe methods:
    • Rename .resolve(..).fromResolver(..)
    • Rename thenResolve(..).resolve(..)
    • Rename .runEffect(..).fromEffect(..)
    • Rename .thenRunEffect(..).runEffect(..)
  • Refactor ResolveHandler methods:
    • Rename .orDefault(..).orElse(..)
    • Add .orElse(..) overload with mapper Function<E, T>
    • Add .orElse(..) overload with supplying Supplier<T>
  • Refactor EffectHandler methods:
    • Rename onErrorThrow(..).orThrow(..)
    • Add .orElse(..) with Consumer<E>
    • Add .orElse(..) with Runnable
  • Refactor error handling of ResolveHandler:
    • Remove .onError(..)
      • Is the same as the new .orElse(mapper) plus the new .catchError(..) overloads
    • Add .catchError(..) overload matching specific type, with Supplier<T>
    • Add .catchError(..) overload without spec type, with Function<E, T>
    • Add .catchError(..) overload without specific type, with Supplier<T>
    • Add .doOnError(..) overload matching specific type, with Consumer<E>
    • Add .doOnError(..) overload matching specific type, with Runnable
    • Add .doOnError(..) overload without specific type, with Runnable
  • Refactor error handling of EffectHandler:
    • Fix .doOnError(..) to not recover from the error
    • Add .doOnError(..) overload without specific type, with Runnable
    • Add .doOnError(..) overload matching specific type, with Consumer<X>
    • Add .doOnError(..) overload matching specific type, with Runnable
    • Add .catchError(..) overload matching specific type, with Runnable
    • Add .catchError(..) overload without specific type, with Consumer<E>
    • Add .catchError(..) overload without specific type, with Runnable

New features

  • Add .doOnSuccess(..) operator to both ResolveHandler and EffectHandler
  • Add partial implementation overloads to .fromResolver(..) and .fromEffect(..)
  • Add .resolve(..) to the ResolveHandler with 2 overloads:
    • Map and ignore any possible error
    • Unwrap-like mapper: Two mappers, one for success another for error
  • Add .fromOptional(..) static creator