4
4
import io .github .erdos .stencil .functions .FunctionEvaluator ;
5
5
import io .github .erdos .stencil .impl .NativeTemplateFactory ;
6
6
7
- import java .io .File ;
8
7
import java .io .IOException ;
8
+ import java .nio .file .Path ;
9
9
import java .util .Collection ;
10
10
import java .util .Map ;
11
11
@@ -19,33 +19,33 @@ private API() {}
19
19
/**
20
20
* Prepares a document template file from the file system.
21
21
*/
22
- public static PreparedTemplate prepare (File templateFile ) throws IOException {
23
- return prepare (templateFile , PrepareOptions .options ());
22
+ public static PreparedTemplate prepare (Path templateSource ) throws IOException {
23
+ return prepare (templateSource , PrepareOptions .options ());
24
24
}
25
25
26
26
/**
27
27
* Prepares a document template file from the file system.
28
28
*/
29
- public static PreparedTemplate prepare (File templateFile , PrepareOptions options ) throws IOException {
30
- return new NativeTemplateFactory ().prepareTemplateFile (templateFile , options );
29
+ public static PreparedTemplate prepare (Path templateSource , PrepareOptions options ) throws IOException {
30
+ return new NativeTemplateFactory ().prepareTemplateFile (templateSource , options );
31
31
}
32
32
33
33
/**
34
34
* Prepares a document fragment from the file system. Fragments can be used to embed extra content when rendering
35
35
* document templates. For example, custom headers and footers can be reused across documents this way.
36
36
*
37
- * @param fragmentFile template file from file system to be used as document fragment
37
+ * @param fragmentSource template file from file system to be used as document fragment
38
38
* @return fragment instance, not null
39
39
* @throws IllegalArgumentException when fragmentFile is null
40
40
* @throws IOException on file system error
41
41
* @throws java.io.FileNotFoundException when file is not found on file system
42
42
*/
43
- public static PreparedFragment fragment (File fragmentFile , PrepareOptions options ) throws IOException {
44
- return new NativeTemplateFactory ().prepareFragmentFile (fragmentFile , options );
43
+ public static PreparedFragment fragment (Path fragmentSource , PrepareOptions options ) throws IOException {
44
+ return new NativeTemplateFactory ().prepareFragmentFile (fragmentSource , options );
45
45
}
46
46
47
- public static PreparedFragment fragment (File fragmentFile ) throws IOException {
48
- return fragment (fragmentFile , PrepareOptions .options ());
47
+ public static PreparedFragment fragment (Path fragmentSource ) throws IOException {
48
+ return fragment (fragmentSource , PrepareOptions .options ());
49
49
}
50
50
51
51
public static EvaluatedDocument render (PreparedTemplate template , TemplateData data ) {
0 commit comments