File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
net.lecousin.core/src/main/java/net/lecousin/framework/application Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ private Application(
92
92
private String [] languageTag ;
93
93
private LoggerFactory loggerFactory ;
94
94
private Map <Class <?>, Object > instances = new HashMap <>();
95
+ private Map <String , Object > data = new HashMap <>();
95
96
private ArrayList <Closeable > toCloseSync = new ArrayList <>();
96
97
private ArrayList <AsyncCloseable <?>> toCloseAsync = new ArrayList <>();
97
98
private boolean stopping = false ;
@@ -239,6 +240,16 @@ public <T> void setInstance(Class<T> clazz, T instance) {
239
240
instances .put (clazz , instance );
240
241
}
241
242
243
+ /** Get a data associated with this application. */
244
+ public Object getData (String name ) {
245
+ return data .get (name );
246
+ }
247
+
248
+ /** Set a data associated with this application and return previously associated data with this name. */
249
+ public Object setData (String name , Object value ) {
250
+ return data .put (name , value );
251
+ }
252
+
242
253
/** Method to call at the beginning of the application, typically in the main method. */
243
254
public static ISynchronizationPoint <Exception > start (
244
255
Artifact artifact ,
You can’t perform that action at this time.
0 commit comments