Annotation Interface StoreParams


@Documented @Retention(RUNTIME) @Target(METHOD) public @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

    Required Elements
    Modifier and Type
    Required Element
    Description
    parameters which should be stored in the associated Store Manager.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The optional name qualifier of the Store Manager to use.
    The Storing strategy.
  • Element Details

    • value

      String[] value
      parameters which should be stored in the associated Store Manager.
      Returns:
      parameters name which should be stored in the associated Store Manager.
    • name

      @AliasFor(member="value") String name
      The optional name qualifier of the Store Manager to use. If your application only have a EclipseStore instance, this is not required
      Returns:
      The name qualifier of the Store Manager to use.
      Default:
      ""
    • strategy

      StoringStrategy strategy
      The Storing strategy. Defaults to Lazy.
      Returns:
      Storing Strategy;
      Default:
      LAZY