SealedTrait

magnolia1.SealedTrait
See theSealedTrait companion object
case class SealedTrait[Typeclass[_], Type](typeInfo: TypeInfo, subtypes: IArray[Subtype[Typeclass, Type, _]], annotations: IArray[Any], typeAnnotations: IArray[Any], isEnum: Boolean, inheritedAnnotations: IArray[Any]) extends Serializable

Represents a Sealed-Trait or a Scala 3 Enum.

In the terminology of Algebraic Data Types (ADTs), sealed-traits/enums are termed 'sum types'.

Attributes

Companion
object
Graph
Supertypes
trait Product
trait Equals
trait Serializable
class Object
trait Matchable
class Any
Show all

Members list

Type members

Types

type Subtype[S] = SubtypeValue[Typeclass, Type, S]

Value members

Constructors

def this(typeInfo: TypeInfo, subtypes: IArray[Subtype[Typeclass, Type, _]], annotations: IArray[Any], typeAnnotations: IArray[Any], isEnum: Boolean)

Concrete methods

def choose[Return](value: Type)(handle: SubtypeValue[Typeclass, Type, _] => Return): Return

Provides a way to recieve the type info for the explicit subtype that 'value' is an instance of. So if 'Type' is a Sealed Trait or Scala 3 Enum like 'Suit', the 'handle' function will be supplied with the type info for the specific subtype of 'value', eg 'Diamonds'.

Provides a way to recieve the type info for the explicit subtype that 'value' is an instance of. So if 'Type' is a Sealed Trait or Scala 3 Enum like 'Suit', the 'handle' function will be supplied with the type info for the specific subtype of 'value', eg 'Diamonds'.

Type parameters

Return

whatever type the 'handle' function wants to return

Value parameters

handle

function that will be passed the Subtype of 'value'

value

must be instance of a subtype of typeInfo

Attributes

Returns

whatever the 'handle' function returned!

def copy(typeInfo: TypeInfo, subtypes: IArray[Subtype[Typeclass, Type, _]], annotations: IArray[Any], typeAnnotations: IArray[Any], isEnum: Boolean): SealedTrait[Typeclass, Type]
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product