Bit of a wierd requirement.
public class DummyClass{ public static final DummyClass var1; public static final DummyClass var2; public static final Dummy
You could use reflection:
Field[] fields = DummyClass.class.getDeclaredFields(); for (Field f : fields) { if (Modifier.isStatic(f.getModifiers()) && isRightName(f.getName())) { doWhatever(f); } }