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

io.quarkiverse.cxf.deployment.JaxbProcessor Maven / Gradle / Ivy

The newest version!
package io.quarkiverse.cxf.deployment;

import java.util.stream.Stream;

import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

/**
 * {@link BuildStep}s related to {@code org.glassfish.jaxb:*}.
 */
class JaxbProcessor {

    @BuildStep
    void indexDependencies(BuildProducer indexDependencies) {
        Stream.of(
                "org.glassfish.jaxb:txw2",
                "org.glassfish.jaxb:jaxb-runtime")
                .forEach(ga -> {
                    String[] coords = ga.split(":");
                    indexDependencies.produce(new IndexDependencyBuildItem(coords[0], coords[1]));
                });
    }

    @BuildStep
    void registerWsSecurityReflectionItems(CombinedIndexBuildItem combinedIndexBuildItem,
            BuildProducer reflectiveClass) {
        final IndexView index = combinedIndexBuildItem.getIndex();

        Stream.of(
                "jakarta.xml.bind.JAXBElement",
                "com.sun.xml.bind.v2.runtime.JaxBeanInfo",
                "org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo")
                .flatMap(className -> index.getAllKnownSubclasses(DotName.createSimple(className)).stream())
                .map(classInfo -> classInfo.name().toString())
                .map(className -> ReflectiveClassBuildItem.builder(className).methods().build())
                .forEach(reflectiveClass::produce);

        reflectiveClass.produce(ReflectiveClassBuildItem.builder(
                "org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl",
                "org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo").methods().build());

    }

    @BuildStep
    void reflectiveClasses(BuildProducer reflectiveClasses) {
        reflectiveClasses.produce(ReflectiveClassBuildItem.builder(
                "org.glassfish.jaxb.core.marshaller.MinimumEscapeHandler",
                "org.glassfish.jaxb.core.marshaller.NoEscapeHandler")
                .fields()
                .build());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy