io.quarkiverse.jasperreports.deployment.BarcodeProcessor Maven / Gradle / Ivy
The newest version!
package io.quarkiverse.jasperreports.deployment;
import java.util.ArrayList;
import java.util.List;
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;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem;
import io.quarkus.logging.Log;
/**
* Register barcode libraries (much moved to Quarkus Barcode)
*/
public class BarcodeProcessor extends AbstractJandexProcessor {
@BuildStep
void indexTransitiveDependencies(BuildProducer index) {
index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports-barcode4j"));
}
@BuildStep
void runtimeBarcodeInitializedClasses(BuildProducer runtimeInitializedPackages) {
//@formatter:off
final List classes = new ArrayList<>();
classes.add(net.sf.jasperreports.barcode4j.BarcodeUtils.class.getName());
//@formatter:on
Log.debugf("Barcode4J Runtime: %s", classes);
classes.stream()
.map(RuntimeInitializedPackageBuildItem::new)
.forEach(runtimeInitializedPackages::produce);
}
@BuildStep
void registerBarcodeForReflection(BuildProducer reflectiveClass,
CombinedIndexBuildItem combinedIndex) {
final List classNames = new ArrayList<>(collectClassesInPackage(combinedIndex,
net.sf.jasperreports.barcode4j.Barcode4JExtensionsRegistryFactory.class.getPackageName()));
Log.debugf("Barcode4J Reflection: %s", classNames);
// methods and fields
reflectiveClass.produce(
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods().fields().serialization().build());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy