1、组装解析器体系
使用 Map<String, DXFSectionHandler>作为解析器容器,键值为SECTION名,如“HEADERS”、“ENTITIES”。
SectionHandler Key 如下:
public enum SectionHandler {
BLOCKS("BLOCKS"),
CLASSES("CLASSES"),
ENTITIES("ENTITIES"),
HEADER("HEADER"),
OBJECTS("OBJECTS"),
TABLES("TABLES");
private String key;
private SectionHandler(String key) {
this.key = key;
}
public String getKey() {
return key;
}
public static SectionHandler getSectionHandler(String key) {
for (SectionHandler sectionHandler : SectionHandler.values()) {
if (sectionHandler.getKey().equals(key)) {
return sectionHandler;
}
}
return null;
}
}