Convenience methods and implicits for working with scala.util.Either.
Contains a fully type-safe enumeration framework.
Contains a fully type-safe enumeration framework. Takes more setup & code than the built-in scala.Enumeration, but has two distinct advantages:
1. Configurable outcomes when a conversion from a String to Enumeration value fails
2. Non-exhaustive match warnings when one or more Enumeration values are not included in a match
By comparison, scala.Enumeration will allow a match
over as few as one Enumeration type, which runs the risk
of a scala.MatchError. This will alert at compile time as to the possibility of a match
miss.
As of Jackson 2.x, a method exists to directly serialize scala.Enumeration, which involves writing less up-front boilerplate. One distinct downside, however, is the need for a special Jackson annotation on case classes that use Enumerations in this way. The annotation must be applied directly to each case class member that is an Enumeration. In this way, serializing scala.Enumeration in Jackson involves substantially more boilerplate effort than the custom Enumeration presented here. See https://github.com/FasterXML/jackson-module-scala/wiki/Enumeration for more information.
For these reasons, our custom Enumeration type should be preferred instead of scala.Enumeration or java.util.Enumeration. See the examples subproject for a sample implementation.
Convenience methods and implicits for working with Futures.
Convenience methods and implicits for working with logging.
Convenience methods and implicit wrappers for working with scala.Option
Convenience methods and implicit wrappers for working with scala.collection.Seq
Convenience methods and implicit wrappers for working with Strings
Convenience wrappers and methods for working with scala.util.Try.
Convenience wrappers and methods for working with scala.util.Try.
Named trys
so that it doesn't conflict with the try
keyword (backticks on packages are unattractive).
Convenience methods and implicits for working with scala.util.Either.
When working with Either, our convention is to right-bias correct values. That is, when working with an Either, prefer to use
Either[Failure, Success]
as the pattern.Additionally, strongly prefer to use scala.util.Try over Either whenever a failure case is to be a Throwable. In general practice, this should encompass the vast majority of cases.