Annotation Interface StoreParams
An around annotation for methods which simplifies storing objects in an associated Store Manager.
This annotation will wrap the decorated method to ensure thread isolation.
You can store method parameters.
A method such as this:
@Store(parameters = "customers") protected Customer addCustomer(Map<String, Customer> customers, CustomerSave customerSave) { String id = UUID.randomUUID().toString(); Customer customer = new Customer(id, customerSave.getFirstName(), customerSave.getLastName()); customers.put(id, customer); return customer; }
Becomes
protected Customer addCustomer(Map<String, Customer> customers, CustomerSave customerSave) { return XThreads.executeSynchronized(() -> { String id = UUID.randomUUID().toString(); Customer customer = new Customer(id, customerSave.getFirstName(), customerSave.getLastName()); customers.put(id, customer); embeddedStorageManager.store(customers); return customer; }); }
- Since:
- 1.0.0
- Author:
- Tim Yates, Sergio del Amo
- See Also:
-
Required Element Summary
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe optional name qualifier of the Store Manager to use.The Storing strategy.
-
Element Details
-
value
String[] valueparameters which should be stored in the associated Store Manager.- Returns:
- parameters name which should be stored in the associated Store Manager.
-
-
-
name
The optional name qualifier of the Store Manager to use. If your application only have a MicroStream instance, this is not required- Returns:
- The name qualifier of the Store Manager to use.
- Default:
- ""
-
strategy
StoringStrategy strategyThe Storing strategy. Defaults to Lazy.- Returns:
- Storing Strategy;
- Default:
- LAZY
-