Configuration 有输入代码配置可以吗?

Configuration 有输入代码配置可以吗?,configuration,code-structure,Configuration,Code Structure,我们有如下一些配置存储类: public class Configuration { private static final Map<DocType, Map<ReportType, Template>> templates = new HashMap<>(); static { Map<ReportType, Template> docZeroTemplates = new HashMap<>()

我们有如下一些配置存储类:

public class Configuration {

    private static final Map<DocType, Map<ReportType, Template>> templates = new HashMap<>();

    static {
        Map<ReportType, Template> docZeroTemplates = new HashMap<>();
        docZeroTemplates.put(REPORT_ZERO, new Template("/templates/ReportZero.jrxml", ReportZeroSource.class));
        docZeroTemplates.put(REPORT_ONE, new Template("/templates/ReportOne.jrxml", ReportOneSource.class));
        templates.put(DocType.DOC_ZERO, docZeroTemplates);
    }

}
优点:

IDE提供的重构和导航支持。 缺点:

我不确定,好像有什么不对劲。 我甚至不确定它是否应该被称为配置。 我应该用XML替换这些类吗?像这样:

<configuration>
  <document type="document0">
    <reports>
      <report type="report0">
        <path>/templates/document0/report0.jrxml</path>
        <source>org.company.report.ReportZero</source>
      </report>
    </reports>
  </document>
</configuration>