Package it.tidalwave.role
Interface Aggregate<T>
-
- All Known Implementing Classes:
PresentationModelAggregate
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Aggregate<T>
The role of an aggregate object, that is an object which contains other named objects.- Author:
- Fabrizio Giudici
- Stereotype:
- Role
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Class<Aggregate>
_Aggregate_
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Optional<T>
getByName(java.lang.String name)
Returns an object given its name.default java.util.Collection<java.lang.String>
getNames()
Returns the names of contained objects.static <T> Aggregate<T>
newInstance()
Returns a new empty instance that will be populated by means ofwith(String, Object)
.static <T> Aggregate<T>
of(java.lang.String name, T value)
Returns a new instance with the specified (name, value) pair.static <T> Aggregate<T>
of(java.util.Map<java.lang.String,T> mapByName)
Returns a new instance with the specified (name, value) pairs.default Aggregate<T>
with(java.lang.String name, T value)
Returns a new instance with the specified (name, value) pair.
-
-
-
Field Detail
-
_Aggregate_
static final java.lang.Class<Aggregate> _Aggregate_
-
-
Method Detail
-
getByName
@Nonnull java.util.Optional<T> getByName(@Nonnull java.lang.String name)
Returns an object given its name.- Parameters:
name
- the name- Returns:
- the object
-
getNames
@Nonnull default java.util.Collection<java.lang.String> getNames()
Returns the names of contained objects.- Returns:
- the names of the objects
- Since:
- 3.1-ALPHA-8
-
of
@Nonnull static <T> Aggregate<T> of(@Nonnull java.util.Map<java.lang.String,T> mapByName)
Returns a new instance with the specified (name, value) pairs.- Type Parameters:
T
- the static type of the value- Parameters:
mapByName
- the map containing the pairs- Returns:
- the new instance
- Since:
- 3.2-ALPHA-1
-
newInstance
@Nonnull static <T> Aggregate<T> newInstance()
Returns a new empty instance that will be populated by means ofwith(String, Object)
.- Type Parameters:
T
- the static type of the aggregate- Returns:
- the new instance
- Since:
- 3.2-ALPHA-2
-
of
@Nonnull static <T> Aggregate<T> of(@Nonnull java.lang.String name, @Nonnull T value)
Returns a new instance with the specified (name, value) pair.- Type Parameters:
T
- the static type of the aggregate- Parameters:
name
- the name in the pairvalue
- the value in the pair- Returns:
- the new instance
- Since:
- 3.2-ALPHA-1
-
-