enumset

convert a two Byte bit mask into a EnumSet

I am reading a binary file that has values stored in bit masks, both 1 Byte bit masks and 2 Byte bit masks. Each bit in the masks act as a switch that indicates where an Event has transpired. Example of 1 Byte mask: 00000101 Indicates that Event one and Event 3 has transpired. Example of Enum public enum MyEnum { ...

How to map EnumSet (or List of Enums) in an entity using JPA2

I have entity Person: @Entity @Table(schema="", name="PERSON") public class Person { List<PaymentType> paymentTypesList; //some other fields //getters and setters and other logic } and I have enum PaymentType: public enum PaymentType { FIXED, CO_FINANCED, DETERMINED; } how to persist Person and its list of enums (in...

Enumset wrapper for AbstractActions

I'd like to load a series of Swing Actions into a container at runtime and access them by a constant name as is possible with an Enum. The purpose of this would be to both restrict the Actions possible and also improve readability. Initially, I was considering a sort of dynamic enum (see http://blog.xebia.com/2009/04/02/dynamic-enums-in...

Combining Java EnumSets

If I have an Enum, I can create an EnumSet using the handy EnumSet class enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES } EnumSet<Suit> reds = EnumSet.of(Suit.HEARTS, Suit.DIAMONDS); EnumSet<Suit> blacks = EnumSet.of(Suit.CLUBS, Suit.SPADES); Give two EnumSets, how can I create a new EnumSet which contains the union of both of those sets...

How can I mimic a multi-tiered menuing system using Java enums?

I need to accomplish the following (this is a simplified version): enum Animals{ enum Cats{tabby("some value"), siamese("some value")}, enum Dogs{poodle("some value"), dachsund("some value")}, enum Birds{canary("some value"), parrot("some value")} private String someValue = ""; private ShopByCategory(String someValue) { th...