Class Sealable
java.lang.Object
name.martingeisse.grumpyjson.registry.Sealable
- Direct Known Subclasses:
Registry
Base class for everything whose lifecycle is divided into configuration phase and run-time phase. Subclasses
define what operations are allowed in either phase. The transition from configuration phase to run-time phase is
called "sealing" this object. The separation into two phases may allow internal optimization depending on the
subclass, and in general enforces to some degree that application code uses this class as intended.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidThrows anIllegalStateExceptionif this object has been sealed already.protected final voidThrows anIllegalStateExceptionif this object has not yet been sealed.protected voidonSeal()Subclasses may perform seal-time operations here, e.g. optimize their internal data structures to prepare for run-time.final voidseal()Seals this object, moving from the configuration phase to the run-time phase.
-
Constructor Details
-
Sealable
public Sealable()Constructor
-
-
Method Details
-
ensureConfigurationPhase
protected final void ensureConfigurationPhase()Throws anIllegalStateExceptionif this object has been sealed already. -
ensureRunTimePhase
protected final void ensureRunTimePhase()Throws anIllegalStateExceptionif this object has not yet been sealed. -
seal
public final void seal()Seals this object, moving from the configuration phase to the run-time phase. -
onSeal
protected void onSeal()Subclasses may perform seal-time operations here, e.g. optimize their internal data structures to prepare for run-time.
-