- java.lang.Object
-
- picocli.codegen.aot.graalvm.DynamicProxyConfigGenerator
-
public class DynamicProxyConfigGenerator extends Object
DynamicProxyConfigGeneratorgenerates a JSON String with the fully qualified interface names for which dynamic proxy classes should be generated at native image build time.Substrate VM doesn't provide machinery for generating and interpreting bytecodes at run time. Therefore all dynamic proxy classes need to be generated at native image build time.
The output of
DynamicProxyConfigGeneratoris intended to be passed to the-H:DynamicProxyConfigurationFiles=/path/to/proxy-config.jsonoption of thenative-imageGraalVM utility. This allows picocli-based native image applications that use@Command-annotated interfaces with@Optionand@Parameters-annotated methods to define options and positional parameters.Alternatively, the generated configuration files can be supplied to the
native-imagetool by placing them in aMETA-INF/native-image/directory on the class path, for example, in a JAR file used in the image build. This directory (or any of its subdirectories) is searched for files with the namesjni-config.json,reflect-config.json,proxy-config.jsonandresource-config.json, which are then automatically included in the build. Not all of those files must be present. When multiple files with the same name are found, all of them are included.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description DynamicProxyConfigGenerator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgenerateProxyConfig(CommandLine.Model.CommandSpec[] specs, String[] interfaceClasses)Returns a JSON String with the interface names to generate dynamic proxy classes for in the native image, used by the specifiedCommandSpecobjects.static voidmain(String... args)Runs this class as a standalone application, printing the resulting JSON String to a file or toSystem.out.
-
-
-
Method Detail
-
main
public static void main(String... args)
Runs this class as a standalone application, printing the resulting JSON String to a file or toSystem.out.- Parameters:
args- one or more fully qualified class names of@Command-annotated classes.
-
generateProxyConfig
public static String generateProxyConfig(CommandLine.Model.CommandSpec[] specs, String[] interfaceClasses)
Returns a JSON String with the interface names to generate dynamic proxy classes for in the native image, used by the specifiedCommandSpecobjects.- Parameters:
specs- one or moreCommandSpecobjects to inspect for dynamic proxiesinterfaceClasses- other (non-@Command) fully qualified interface names to generate dynamic proxy classes for- Returns:
- a JSON String in the format
required by the
-H:DynamicProxyConfigurationFiles=/path/to/proxy-config.jsonoption of the GraalVMnative-imageutility.
-
-