@@ -74,39 +74,7 @@ private void createFile() {
74
74
}
75
75
76
76
public void addSource (String name , Supplier <Object > supplier ) {
77
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
78
- }
79
-
80
- public void addDoubleSource (String name , Supplier <Double > supplier ) {
81
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
82
- }
83
-
84
- public void addFloatSource (String name , Supplier <Float > supplier ) {
85
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
86
- }
87
-
88
- public void addShortSource (String name , Supplier <Short > supplier ) {
89
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
90
- }
91
-
92
- public void addIntegerSource (String name , Supplier <Integer > supplier ) {
93
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
94
- }
95
-
96
- public void addLongSource (String name , Supplier <Long > supplier ) {
97
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
98
- }
99
-
100
- public void addBooleanSource (String name , Supplier <Boolean > supplier ) {
101
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
102
- }
103
-
104
- public void addStringSource (String name , Supplier <String > supplier ) {
105
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
106
- }
107
-
108
- public void addCharacterSource (String name , Supplier <Character > supplier ) {
109
- dataSources .add (new LogSource (name , supplier .get ()::toString ));
77
+ dataSources .add (new LogSource (name , supplier ));
110
78
}
111
79
112
80
public void saveLogs () {
@@ -134,14 +102,14 @@ private void saveTitles() throws IOException {
134
102
}
135
103
136
104
private String getValues () {
137
- return dataSources .stream ().map (s -> s .supplier .get ()).collect (Collectors .joining ("," ));
105
+ return dataSources .stream ().map (s -> s .supplier .get ()).map ( Object :: toString ). collect (Collectors .joining ("," ));
138
106
}
139
107
140
108
private class LogSource {
141
109
private final String name ;
142
- private final Supplier <String > supplier ;
110
+ private final Supplier <Object > supplier ;
143
111
144
- public LogSource (String name , Supplier <String > supplier ) {
112
+ public LogSource (String name , Supplier <Object > supplier ) {
145
113
this .name = name ;
146
114
this .supplier = supplier ;
147
115
}
0 commit comments