Skip to content

Sealed Interfaceとは何か

パッケージの外で実装できないインターフェイスのこと。Goでは次のように未公開メソッドを含むことで実現できる。

type Option interface {
privateOption()
}

言葉はおそらくJavaまたはそれに類する宣言に由来している。

public sealed interface Service permits S3, EC2, RDS {
}