}
}
private void createPermissionVoters(AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) {
VoterNameFactory nameFactory = CodiUtils.getContextualReferenceByClass(beanManager, VoterNameFactory.class);
Class<? extends NamedPermission> namedPermissionClass = config.getNamedPermissionClass();
if (namedPermissionClass != null) {
Object[] constants = namedPermissionClass.getEnumConstants();
AnnotatedType<GenericPermissionVoter> permissionVoterAnnotatedType = beanManager
.createAnnotatedType(GenericPermissionVoter.class);
InjectionTarget<GenericPermissionVoter> voterInjectionTarget = beanManager
.createInjectionTarget(permissionVoterAnnotatedType);
NamedPermission namedPermission;
String beanName;
for (Object permission : constants) {
namedPermission = (NamedPermission) permission;
beanName = nameFactory.generatePermissionBeanName(namedPermission.name());
Bean<GenericPermissionVoter> bean = new BeanBuilder<GenericPermissionVoter>(beanManager)
.passivationCapable(false).beanClass(GenericPermissionVoter.class)
.injectionPoints(voterInjectionTarget.getInjectionPoints()).name(beanName)
.scope(ApplicationScoped.class).addQualifier(new NamedLiteral(beanName))