Interface RoleFactory<T,R>

Type Parameters:
T - the type of the owner
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 RoleFactory<T,R>
A factory of roles.
Author:
Fabrizio Giudici
  • Method Details

    • createRoleFor

      @Nonnull Optional<R> createRoleFor(@Nonnull T owner)
      Returns one or more roles — if multiple ones have to be returned, they must be wrapped in a Collection..
      Parameters:
      owner - the owner
      Returns:
      one or more roles — if multiple ones have to be returned, they must be wrapped in a Collection
    • getRoleType

      @Nonnull default Class<R> getRoleType()
      Returns the role type..
      Returns:
      the role type
      Since:
      4.0-ALPHA-2
    • resolveFactories

      @Nonnull static <T> Collection<Object> resolveFactories(@Nonnull T owner, @Nonnull Iterable<Object> roleOrFactories)
      Returns a collection of roles resolving factories.; that is, any factory in the collection is invoked so it can eventually create another role.
      Parameters:
      owner - the role owner
      roleOrFactories - a collection of roles or RoleFactory instances
      Returns:
      a collection of roles resolving factories
      Since:
      4.0-ALPHA-2