1
1
package com .reedelk .file .internal .commons ;
2
2
3
+ import com .reedelk .runtime .api .commons .FormattedMessage ;
4
+
3
5
public class Messages {
4
6
5
7
private Messages () {
6
8
}
7
9
8
- private static String formatMessage (String template , Object ...args ) {
9
- return String .format (template , args );
10
- }
11
-
12
- interface FormattedMessage {
13
- String format (Object ...args );
14
- }
15
-
16
10
public enum FileReadComponent implements FormattedMessage {
17
11
18
12
FILE_NAME_ERROR ("Could not evaluate file with with name=[%s]" ),
19
13
FILE_IS_DIRECTORY ("Could not read file=[%s]: is a directory" ),
20
14
FILE_LOCK_ERROR ("Could not acquire lock on file=[%s]: %s" ),
21
15
FILE_READ_ERROR ("Could not read file=[%s]: %s" );
22
16
23
- private String msg ;
17
+ private String message ;
24
18
25
- FileReadComponent (String msg ) {
26
- this .msg = msg ;
19
+ FileReadComponent (String message ) {
20
+ this .message = message ;
27
21
}
28
22
29
23
@ Override
30
- public String format ( Object ... args ) {
31
- return formatMessage ( msg , args ) ;
24
+ public String template ( ) {
25
+ return message ;
32
26
}
33
27
}
34
28
@@ -39,17 +33,16 @@ public enum FileWriteComponent implements FormattedMessage {
39
33
ERROR_FILE_WRITE_WITH_PATH ("Could not write file with path=[%s]: %s" ),
40
34
ERROR_FILE_WRITE ("Could not write file: %s" );
41
35
42
- private String msg ;
36
+ private String message ;
43
37
44
- FileWriteComponent (String msg ) {
45
- this .msg = msg ;
38
+ FileWriteComponent (String message ) {
39
+ this .message = message ;
46
40
}
47
41
48
42
@ Override
49
- public String format ( Object ... args ) {
50
- return formatMessage ( msg , args ) ;
43
+ public String template ( ) {
44
+ return message ;
51
45
}
52
-
53
46
}
54
47
55
48
public enum Misc implements FormattedMessage {
@@ -58,16 +51,15 @@ public enum Misc implements FormattedMessage {
58
51
FILE_LOCK_MAX_RETRY_ERROR ("Could not acquire lock on file=[%s]: %s" ),
59
52
MAX_ATTEMPTS_EXCEEDED ("Max retry attempts (%d) exceeded" );
60
53
61
- private String msg ;
54
+ private String message ;
62
55
63
- Misc (String msg ) {
64
- this .msg = msg ;
56
+ Misc (String message ) {
57
+ this .message = message ;
65
58
}
66
59
67
60
@ Override
68
- public String format ( Object ... args ) {
69
- return formatMessage ( msg , args ) ;
61
+ public String template ( ) {
62
+ return message ;
70
63
}
71
-
72
64
}
73
65
}
0 commit comments