Project EnumBitSet

This is the project home for EnumBitSet. It's a small project offering more functionality with enum types in Java.

Java 8 is needed to use any of the code!!

Is EnumBitSet the right thing for you?

Do you know this situation: You have created some enum types in Java and now you want to use them but you don't know how to store them in a database? Hibernate and JPA can help you but ORM isn't always the best approach. Maybe you just want to have more control on how the data is stored to the database.
EnumBitSet can help you working with sets of enum constants and storing those sets in one single database field. Just use the method toLong() if you are sure that there are not more than 64 elements in the enum type. Or use toBigInteger() for enum types of any size.
This library also offers a more general interface to bit sets that are restricted by a domain (universe). Three implementations exist:

Where to get it?

The project is hosted on GitHub:

Download as JAR: EnumBitSet.jar

How to use it

EnumBitSet implements Collection. So it's use is familiar.
Example code can be found in the project readme and in the javadoc.

Terms, warranty and license

Well, I won't sue you. But if you use this and claim it's yours then you are stupid and I will tell your mother.
You can't sue me because the code is so simple that it just couldn't violate any patents. And the code is provided "as is" — without any guarantees.
A copy of the MIT license is in the project.


Note: This might be out of date but you can generate this from the source using the ANT build file.


About the author: Home Page