Note: information on this page refers to Ceylon 1.1, not to the current release.

sealed annotation

The sealed annotation prevents certain kinds of use of the declaration outside the module containing the declaration.

A sealed interface cannot by satisfied by a class or interface outside the module in which it is defined.

A sealed class cannot be extended or instantiated outside the module in which it is defined.

Usage

On a declaration:

shared sealed class SealedClass() {
}
shared sealed interface SealedInterface {
}

Description

The sealed annotation allowed the program author the means to provide client modules with access to sealed class and interface types without losing control over their subtypes or instances.

See also