My code consumes two libraries - LibraryA and LibraryB.
LibraryA has defined an enum :
public enum EnumA {
FIRST,
SECOND;
}
LibraryB has also defined an enum :
public enum EnumB {
ONE,
TWO;
}
How can I aggregate these two enums in my code into a single type - class or enum, say MyAggregatedEnum
so that I can enumerate on values defined in both EnumA and EnumB.
Edit :
Editing to include a more concrete use case. I want to have a Map<MyAggregatedEnum, TypeHandler>
. This map will be created statically. For each individual value, there can be a different TypeHandler. Eg. for FIRST
, there can be a type handler - HandlerFirst
, for ONE
, there can be a type handler - HandlerOne
, and so on.
Apologies for not adding this in the first draft itself.
I can't make library enums to implement some common interface.