Skip to content

Library: Half-open Enumeration pattern #5

@stijn-dejongh

Description

@stijn-dejongh

Outline

Combine the type safety and determinism of enumerations with the runtype/deploy time extensibility offered by configuration files. A half-open enumeration type will first look through it's predefined (in-code) specifications, and add a new type object in case the requested type is not available.

Usage desiderata

Should read similarly to the Optional class in java enumFor(String name).orElse(EnumClass::create).

Implementation Notes

  • This is basically a constrained Factory Class pattern on top of predefined enumerations.
  • There should be an option to configure the factory to only allow the creation of new Type-objects if they adhere to certain conditions ( e.g. "exist in database", "are listed in config file", "contain certain words" )

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions