1
1
/*
2
- * Copyright 2016 DiffPlug
2
+ * Copyright 2016-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
package com .diffplug .spotless .sql ;
17
17
18
18
import java .io .File ;
19
- import java .io .Serializable ;
20
19
21
20
import com .diffplug .spotless .FileSignature ;
22
21
import com .diffplug .spotless .FormatterFunc ;
@@ -32,24 +31,14 @@ public class DBeaverSQLFormatterStep {
32
31
private DBeaverSQLFormatterStep () {}
33
32
34
33
public static FormatterStep create (Iterable <File > files ) {
35
- return FormatterStep .createLazy (NAME ,
36
- () -> new State ( files ) ,
37
- State ::createFormat );
34
+ return FormatterStep .create (NAME , FileSignature . promise ( files ) ,
35
+ FileSignature . Promised :: get ,
36
+ DBeaverSQLFormatterStep ::createFormat );
38
37
}
39
38
40
- static final class State implements Serializable {
41
- private static final long serialVersionUID = 1L ;
42
-
43
- final FileSignature settingsSignature ;
44
-
45
- State (final Iterable <File > settingsFiles ) throws Exception {
46
- this .settingsSignature = FileSignature .signAsList (settingsFiles );
47
- }
48
-
49
- FormatterFunc createFormat () throws Exception {
50
- FormatterProperties preferences = FormatterProperties .from (settingsSignature .files ());
51
- DBeaverSQLFormatter dbeaverSqlFormatter = new DBeaverSQLFormatter (preferences .getProperties ());
52
- return dbeaverSqlFormatter ::format ;
53
- }
39
+ private static FormatterFunc createFormat (FileSignature settings ) {
40
+ FormatterProperties preferences = FormatterProperties .from (settings .files ());
41
+ DBeaverSQLFormatter dbeaverSqlFormatter = new DBeaverSQLFormatter (preferences .getProperties ());
42
+ return dbeaverSqlFormatter ::format ;
54
43
}
55
44
}
0 commit comments