Package it.tidalwave.role.ui
Class PresentationModelAggregate
- java.lang.Object
-
- it.tidalwave.role.ui.PresentationModelAggregate
-
- All Implemented Interfaces:
Aggregate<PresentationModel>
public class PresentationModelAggregate extends java.lang.Object implements Aggregate<PresentationModel>
A specialisation ofAggregate<PresentationModel>which offers a convenience method for aggregating its contained objects.- Since:
- 3.2-ALPHA-3
- Author:
- Fabrizio Giudici
-
-
Field Summary
-
Fields inherited from interface it.tidalwave.role.Aggregate
_Aggregate_
-
-
Constructor Summary
Constructors Constructor Description PresentationModelAggregate()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<PresentationModel>getByName(java.lang.String name)Returns an object given its name.java.util.Collection<java.lang.String>getNames()Returns the names of contained objects.static PresentationModelAggregatenewInstance()Creates a new, empty instance.PresentationModelAggregatewithPmOf(java.lang.String name, java.util.Collection<java.lang.Object> roles)Adds anotherPresentationModelwith the given roles, associated to the given name.
-
-
-
Method Detail
-
newInstance
@Nonnull public static PresentationModelAggregate newInstance()
Creates a new, empty instance.- Returns:
- the new instance
-
withPmOf
@Nonnull public PresentationModelAggregate withPmOf(@Nonnull java.lang.String name, @Nonnull java.util.Collection<java.lang.Object> roles)
Adds anotherPresentationModelwith the given roles, associated to the given name. With a plainAggregate<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 thePresentationModelroles- the roles- Returns:
- the new
PresentationModel
-
getByName
@Nonnull public java.util.Optional<PresentationModel> getByName(@Nonnull java.lang.String name)
Returns an object given its name.- Specified by:
getByNamein interfaceAggregate<PresentationModel>- Parameters:
name- the name- Returns:
- the object
-
getNames
@Nonnull public java.util.Collection<java.lang.String> getNames()
Returns the names of contained objects.- Specified by:
getNamesin interfaceAggregate<PresentationModel>- Returns:
- the names of the objects
-
-