BAEL-1041 Introduction to Caffeine (#2585)
* BAEL-748 quick guide to @Value * BAEL-748 changes from review * BAEL-748 inject comma-separated values into array * BAEL-768 Introduction to Netty * BAEL-768 remove commented code * BAEL-861 Introduction to Awaitility * BAEL-861 rename Test to UnitTest * BAEL-1041 Introduction in Caffeine * BAEL-1041 fix test * BAEL-1041 fix formatting * BAEL-1041 fix expected/actual order * BAEL-1041 remove trailing underscore * Formatting after merge * BAEL-1041 add spaces between data and assertions * BAEL-1041 soft values example * BAEL-1041 remove duplicate dependency * BAEL-1041 formatting fix * BAEL-1041 formatting fix
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.baeldung.caffeine;
|
||||
|
||||
final class DataObject {
|
||||
private final String data;
|
||||
|
||||
private static int objectCounter = 0;
|
||||
|
||||
private DataObject(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataObject{" +
|
||||
"data='" + data + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static DataObject get(String data) {
|
||||
objectCounter++;
|
||||
System.out.println(String.format("Initializing DataObject#%d with data '%s'", objectCounter, data));
|
||||
return new DataObject(data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user