All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.weld.deployment.CdiAnnotationProcessor Maven / Gradle / Ivy

There is a newer version: 33.0.2.Final
Show newest version
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package org.jboss.as.weld.deployment;

import org.jboss.as.server.deployment.Attachments;
import org.jboss.as.server.deployment.DeploymentPhaseContext;
import org.jboss.as.server.deployment.DeploymentUnit;
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.as.server.deployment.annotation.CompositeIndex;
import org.jboss.as.weld.CdiAnnotations;

/**
 * CdiAnnotationProcessor class. Used to verify the presence of CDI annotations.
 */
public class CdiAnnotationProcessor implements DeploymentUnitProcessor {
    @Override
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();

        final CompositeIndex index = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);

        for (final CdiAnnotations annotation : CdiAnnotations.values()) {
            if (!index.getAnnotations(annotation.getDotName()).isEmpty()) {
                CdiAnnotationMarker.mark(deploymentUnit);
                return;
            }
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy