Skip to content

Commit

Permalink
PDF test
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Apr 19, 2024
1 parent a9c438d commit 880ae4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,16 @@ void registerForReflection(PrimeFacesRecorder recorder, BuildProducer<Reflective
// Chart XDev models
classNames.addAll(collectClassesInPackage(combinedIndex, "software.xdev.chartjs.model"));

// method reflection
reflectiveClass.produce(
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods(true)
.fields(true).build());

// constructor reflection

// Exporters
classNames.clear();
classNames.addAll(collectImplementors(combinedIndex, org.primefaces.component.export.Exporter.class.getName()));
classNames.addAll(collectImplementors(combinedIndex, org.primefaces.component.export.ExporterOptions.class.getName()));
classNames.remove("org.primefaces.component.datatable.export.DataTablePDFExporter");
classNames.remove("org.primefaces.component.treetable.export.TreeTablePDFExporter");

// method reflection
reflectiveClass.produce(
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).constructors(true).methods(false)
.fields(false).build());
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods(true)
.fields(true).build());

// neither
reflectiveClass.produce(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.graalvm.nativeimage.hosted.Feature;
import org.graalvm.nativeimage.hosted.RuntimeClassInitialization;
import org.krysalis.barcode4j.output.bitmap.BitmapEncoderRegistry;
import org.primefaces.component.datatable.export.DataTablePDFExporter;
import org.primefaces.component.treetable.export.TreeTablePDFExporter;

public class PrimeFacesFeature implements Feature {
private final static String REASON = "PrimeFaces runtime initialization";
Expand All @@ -11,6 +13,9 @@ public class PrimeFacesFeature implements Feature {
public void afterRegistration(AfterRegistrationAccess access) {
// Barcode component is optional but must register this for native mode since it uses AWT
RuntimeClassInitialization.initializeAtRunTime(BitmapEncoderRegistry.class.getName());
//Exporters
RuntimeClassInitialization.initializeAtRunTime(DataTablePDFExporter.class.getName());
RuntimeClassInitialization.initializeAtRunTime(TreeTablePDFExporter.class.getName());
}

@Override
Expand Down

0 comments on commit 880ae4c

Please sign in to comment.