Class PresentationModelAggregate

java.lang.Object
it.tidalwave.role.ui.PresentationModelAggregate
All Implemented Interfaces:
Aggregate<PresentationModel>

public class PresentationModelAggregate extends Object implements Aggregate<PresentationModel>
A specialisation of Aggregate<PresentationModel> which offers a convenience method for aggregating its contained objects.
Since:
3.2-ALPHA-3
Author:
Fabrizio Giudici
  • Constructor Details

    • PresentationModelAggregate

      public PresentationModelAggregate()
  • Method Details

    • newInstance

      @Nonnull public static PresentationModelAggregate newInstance()
      Creates a new, empty instance.
      Returns:
      the new instance
    • withPmOf

      @Nonnull public PresentationModelAggregate withPmOf(@Nonnull String name, @Nonnull Collection<Object> roles)
      Adds another PresentationModel with the given roles, associated to the given name. With a plain Aggregate<PresentationModel> the code would be:
         Aggregate<PresentationModel> aggregate = Aggregate.newInstance()
                  .with("name", PresentationModel.of("", r(role1, role2, role3));
       
      The simplified code is:
         Aggregate<PresentationModel> aggregate = PresentationModelAggregate.newInstance()
                  .withPmOf("name", r(role1, role2, role3));
       
      Parameters:
      name - the name of the PresentationModel
      roles - the roles
      Returns:
      the new PresentationModel
    • getByName

      @Nonnull public Optional<PresentationModel> getByName(@Nonnull String name)
      Returns an object given its name.
      Specified by:
      getByName in interface Aggregate<PresentationModel>
      Parameters:
      name - the name
      Returns:
      the object
    • getNames

      @Nonnull public Set<String> getNames()
      Returns the names of contained objects.
      Specified by:
      getNames in interface Aggregate<PresentationModel>
      Returns:
      the names of the objects