コード例 #1
0
  public Object findTemplateSource(String name) throws IOException {

    ClassPathTemplateSource source;

    if (relative && (anchorClass != null)) {

      StringBuilder pathBuilder =
          new StringBuilder(anchorClass.getPackage().getName().replace('.', '/'));

      pathBuilder.append('/').append(name);
      source = new ClassPathTemplateSource(classLoader, pathBuilder.toString());
    } else {
      source = new ClassPathTemplateSource(classLoader, name);
    }

    return (source.exists()) ? source : null;
  }
コード例 #2
0
  public void closeTemplateSource(Object templateSource) throws IOException {

    ((ClassPathTemplateSource) templateSource).close();
  }