I'm trying to make my code more extensible for other devs by using Enums rather than an array of strings. I have:
public enum FOO {
A, B, C, D, E
}
and
public enum BAR {
Z, Y, X, W
}
In FOO
I want to be able to define iteratively:
D, E, F(Z), F(Y), F(X), F(W)
So when I add items to BAR, it automatically adds it to FOO. I figure it has to be a method in FOO, and BAR should almost certainly be an inner class (thus private), but I've no idea how to do it. Using
for (BAR b : BAR.values()) {}
seems at least part of the solution. If it helps, for context, I'm using the Pathfinder RPG skills, with a list of each skill:
public enum SkillsEnum {
ACROBATICS,
APPRAISE,
BLUFF,
CLIMB,
CRAFT,
DIPLOMACY,
DISABLE_DEVICE,
DISGUISE,
ESCAPE_ARTIST,
FLY,
HANDLE_ANIMAL,
HEAL,
INTIMIDATE,
KNOWLEDGE(KnowledgeList.values().[0])
KNOWLEDGE(KnowledgeList.values().[1]) etc
}
enum KnowledgeList {
ARCANA,
DUNGEONEERING,
ENGINEERING,
GEOGRAPHY,
HISTORY,
LOCAL,
NATURE,
NOBILITY,
PLANES,
RELIGION
}