< Back
 

# Packages

-  package root
  Definition Classes
    root
-  package uk
  Definition Classes
    root
-  package gov
  Definition Classes
    uk
-  package hmrc
  Definition Classes
    gov
-  package customs
  Definition Classes
    hmrc
-  package api
  Definition Classes
    customs
-  package common
  Definition Classes
    api
-  package config
  Definition Classes
    common
-  class ConfigValidatedNelAdaptor extends AnyRef

  We need a wrapper for ServicesConfig as the current API rely's on throwing exceptions for signalling failure - this is fail fast behaviour.

  We need a wrapper for ServicesConfig as the current API rely's on throwing exceptions for signalling failure - this is fail fast behaviour. What we want is to aggregate errors (on application startup). The `ValidatedNel` class in the `cats` library gives a type that allows us aggregate errors OR apply valid results to a function (such as a case class constructor). It's declaration is `type ValidatedNel[+E, +A] = Validated[NonEmptyList[E], A]` `Nel` is short for `NonEmptyList` which is simply a `List` that is guaranteed to contain at least 1 item.

  Example usage:

      // you will need this import for mapN
      import cats.implicits._

      @Singleton
      class CustomsConfigService @Inject()(configValidatedNel: ConfigValidatedNelAdaptor) {
        private val root = configValidatedNel.root
        private val validatedCustomsEnrolmentConfig: ValidatedNel[String, CustomsEnrolmentConfig] = (
          root.string("customs.enrolment.name"),
          root.string("customs.enrolment.eori-identifier")
        ).mapN(CustomsEnrolmentConfig)
      ...
      }

  Note that the `ValidatedNel` behaviour is derived from it being an Applicative Functor (see https://typelevel.org/cats/typeclasses/applicative.html)

  Definition Classes
    config
  Annotations
    @Singleton()
- RootValidatedNelAdaptor
- UrlNelAdaptor
- ValidatedNelAdaptor

t

uk.gov.hmrc.customs.api.common.config.ConfigValidatedNelAdaptor

# ValidatedNelAdaptor 

###

#### trait ValidatedNelAdaptor extends AnyRef

Linear Supertypes
AnyRef, Any
Known Subclasses
RootValidatedNelAdaptor
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. ValidatedNelAdaptor
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Abstract Value Members

1.  abstract def boolean(key: String): CustomsValidatedNel[Boolean]
2.  abstract def duration(key: String): CustomsValidatedNel[Duration]
3.  abstract def int(key: String): CustomsValidatedNel[Int]
4.  abstract def string(key: String): CustomsValidatedNel[String]

### Concrete Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... ) @native()
6.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
7.  def equals(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
8.  def finalize(): Unit
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( classOf[java.lang.Throwable] )
9.  final def getClass(): Class[_]
   Definition Classes
     AnyRef → Any
   Annotations
     @native()
10.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
11.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
12.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
13.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
14.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
15.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
16.  def toString(): String
    Definition Classes
      AnyRef → Any
17.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
18.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
19.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... ) @native()

### Inherited from AnyRef

### Inherited from Any

### Ungrouped