/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public <T> T as (final @Nonnull Class<T> roleType, final @Nonnull NotFoundBehaviour<T> notFoundBehaviour) { final List<? extends T> roles = roleManager.findRoles(this, roleType); if (roles.isEmpty()) { return notFoundBehaviour.run(new NotFoundException("No " + roleType.getName() + " in " + this)); } return roles.get(0); } }