Annotation Interface StoreReturn
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 a Method return statement.
A method such as this:
@StoreReturn protected Customer updateCustomer(String id, CustomerSave customerSave) { Customer c = data().getCustomers().get(id); if (c != null) { c.setFirstName(customerSave.getFirstName()); c.setLastName(customerSave.getLastName()); return c; } return null; }
Becomes
protected Customer updateCustomer(String id, CustomerSave customerSave) { XThreads.executeSynchronized(() -> { Customer c = data().getCustomers().get(id); if (c != null) { c.setFirstName(customerSave.getFirstName()); c.setLastName(customerSave.getLastName()); embeddedStorageManager.store(c); return c; } return null; } }
- Since:
- 1.0.0
- Author:
- Sergio del Amo
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe optional name qualifier of the Storage Manager to use.The Storing strategy.
-
Element Details
-
name
The optional name qualifier of the Storage Manager to use. If your application only have a EclipseStore instance, this is not required- Returns:
- The name qualifier of the Storage Manager to use.
- Default:
- ""
-
strategy
StoringStrategy strategyThe Storing strategy. Defaults to Lazy.- Returns:
- Storing Strategy;
- Default:
- LAZY
-