scala
scala
列挙型
2系向けの情報
値なし列挙型
sealed trait Enum object Enum { case object EnumA extends Enum case object EnumB extends Enum case object EnumC extends Enum }
値あり列挙型
sealed abstruct class Enum(val value: String) object Enum { case object EnumA extends Enum("a") case object EnumB extends Enum("b") case object EnumC extends Enum("c") }
ドメイン例外クラス設計の例
sealed abstract class HogeException extends Exception case class HogeEntityNotFound(id: Long) extends HogeException case class HogeEntityNotAccesible(id: Long) extends HogeException case class InvalidParameter(nameAndValue: (String, Any)) extends HogeException
scala.txt · 最終更新: 2021/07/29 03:47 by nullpon