abstract class NewtypeWrapped[Src] extends Newtype[Src] with NewWrapped[Src]
Simple variant of Newtype that provides an apply
builder.
Such newtypes are meant for simple wrappers that don't do any validation.
Usage:
type FullName = FullName.Type object FullName extends NewtypeWrapped[String] // Initializing val name: FullName = FullName("Alexandru Nedelcu") // Extracting the value when a string is needed: val nameStr: String = name.value assert(nameStr === "Alexandru Nedelcu") // We can pattern-match too: name match { case FullName(nameStr) => assert(nameStr === "Alexandru Nedelcu") }
- Source
- NewWrapped.scala
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- NewtypeWrapped
- NewWrapped
- Newtype
- NewtypeTrait
- NewEncoding
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Instance Constructors
- new NewtypeWrapped()
Type Members
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def apply(x: Src): Type
- Definition Classes
- NewWrapped
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- implicit final val builder: Aux[Type, Src]
- Definition Classes
- NewWrapped
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def derive[F[_]](implicit ev: F[Src]): F[Type]
- Attributes
- protected
- Definition Classes
- NewEncoding
- Annotations
- @inline()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def extract(value: Type): Src
- Attributes
- protected
- Definition Classes
- NewEncoding
- Annotations
- @inline()
- implicit final val extractor: Aux[Type, Src]
- Definition Classes
- NewEncoding
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- implicit val typeInfo: TypeInfo[Type]
- Definition Classes
- NewEncoding
- final def unapply[A](a: A)(implicit ev: =:=[A, Type]): Some[Src]
- Definition Classes
- NewWrapped
- final def unsafeCoerce(value: Src): Type
- Attributes
- protected
- Definition Classes
- NewEncoding
- Annotations
- @inline()
- final def value(x: Type): Src
- Definition Classes
- NewEncoding
- Annotations
- @inline()
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Macro-free helpers for defining newtypes in Scala.
Links: