Opaque

pl.iterators.kebs.opaque.Opaque
trait Opaque[OpaqueType, Unwrapped](using ev: OpaqueType =:= Unwrapped)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def apply(unwrapped: Unwrapped): OpaqueType

Creates an instance of OpaqueType from unwrapped value.

Creates an instance of OpaqueType from unwrapped value.

Value parameters

unwrapped

value to be validated, transformed and wrapped in OpaqueType

Attributes

Returns

OpaqueType wrapping validated & transformed unwrapped value

Throws
IllegalArgumentException

with reason, if validation fails

def from(unwrapped: Unwrapped): Either[String, OpaqueType]

Validates and transforms (ex. sanitizes) unwrapped value. By default, there is no validation or transformation.

Validates and transforms (ex. sanitizes) unwrapped value. By default, there is no validation or transformation.

Value parameters

unwrapped

value to be validated and transformed

Attributes

Returns

Left(reason) if validation fails; Right(opaqueType) if validation succeeds

def unsafe(unwrapped: Unwrapped): OpaqueType

Creates an instance of OpaqueType from unwrapped value in an unsafe manner - without validation or transformation.

Creates an instance of OpaqueType from unwrapped value in an unsafe manner - without validation or transformation.

Value parameters

unwrapped

value to be wrapped in OpaqueType

Attributes

Returns

OpaqueType wrapping unwrapped value

protected def validate(unwrapped: Unwrapped): Either[String, OpaqueType]

Validates and transforms (ex. sanitizes) unwrapped value.

Validates and transforms (ex. sanitizes) unwrapped value.

Value parameters

unwrapped

value to be validated and transformed

Attributes

Returns

Left(reason) if validation fails; Right(opaqueType) if validation succeeds

Givens

Givens

given cc1Rep: CaseClass1Rep[OpaqueType, Unwrapped]

Extensions

Extensions

extension (w: OpaqueType)
def unwrap: Unwrapped

Unwraps value wrapped in OpaqueType.

Unwraps value wrapped in OpaqueType.

Attributes

Returns

unwrapped value