@Override
protected void handleChildTag() throws XMLStreamException, QuickFixException {
String tag = getTagName();
if (VarDefHandler.TAG.equalsIgnoreCase(tag)) {
VarDef def = new VarDefHandler<ThemeDef>(this, xmlReader, source).getElement();
if (builder.vars().containsKey(def.getName())) {
error("Duplicate var %s", def.getName());
}
builder.addVarDef(def);
} else if (ThemeDefRefHandler.TAG.equalsIgnoreCase(tag)) {
// imports must come before vars. This is mainly for simplifying the var lookup implementation, while still
// matching the most common expected usages of imports vs. declared vars.
if (!builder.vars().isEmpty()) {
error("tag %s must come before all declared vars", ThemeDefRefHandler.TAG);
}
ThemeDefRef def = new ThemeDefRefHandler<ThemeDef>(this, xmlReader, source).getElement();
if (builder.imports().contains(def.getThemeDescriptor())) {
error("Duplicate theme import %s", def.getName());
}
builder.addImport(def.getThemeDescriptor());
} else {
error("Found unexpected tag %s", tag);
}
}