Sealed Enums: a (small) library for creating enum-like structures using sealed classes
Sealed Enums is a library that provides sealed-enum functionality to Java, allowing developers to create enum-like structures using sealed classes. While enums are powerful, they cannot handle generic arguments, which is where sealed classes come in.
The library works by maintaining a set of classes that have been seen, ensuring that duplicate objects are not created for the same class. If a duplicate object is detected, an exception is thrown.
To demonstrate the usage of Sealed Enums with generics, the library provides a decent example in the SealedEnumExample class.
Developers can find the library on GitHub, where they can also contribute to its development. The library is available under the MIT License.
This library is a valuable tool for developers who want to leverage the benefits of enums while also being able to handle generic arguments. It provides a clean and efficient solution for creating enum-like structures using sealed classes.