Class WindowsApiRun
To generate code, create an instance of this class, set the configuration arguments
and call generateCode().
The generated source code uses the Java Foreign Function and Memory API (FFM) and requires Java 23 or higher.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans the output directory.voidcreateDirectory(Path path) Creates the specified directory.voiddryRun()Executes a dry run.voidGenerates the code.Gets the base package for the generated code.Gets the names of the callback functions (function pointers) to generate.Gets the names of the COM interfaces to generate.Gets the names of the constants to generate.Gets the names of the enumerations to generate.Gets the event listener.Gets the names of the Windows API functions to generate.Gets the directory for generating the source code.Gets the names of the C struct and union types to generate.voidsetBasePackage(String basePackage) Sets the base package for the generated code.voidsetCallbackFunctions(Set<String> callbackFunctions) Sets the names of the callback functions (function pointers) to generate.voidsetComInterfaces(Set<String> comInterfaces) Sets the names of the COM interfaces to generate.voidsetConstants(Set<String> constants) Sets the names of the constants to generate.voidsetEnumerations(Set<String> enumerations) Sets the names of the enumerations to generate.voidsetEventListener(EventListener eventListener) Sets the event listener.voidsetFunctions(Set<String> functions) Sets the names of the Windows API functions to generate.voidsetOutputDirectory(Path outputDirectory) Sets the directory for generating the source code.voidsetStructs(Set<String> structs) Sets the names of the C struct and union types to generate.
-
Constructor Details
-
WindowsApiRun
public WindowsApiRun()Creates a new instance.
-
-
Method Details
-
getOutputDirectory
Gets the directory for generating the source code.The specified directory is the root directory for packages and subpackages.
- Returns:
- the directory
-
setOutputDirectory
Sets the directory for generating the source code.The specified directory is the root directory for packages and subpackages.
- Parameters:
outputDirectory- the directory
-
getBasePackage
Gets the base package for the generated code.The generated code will have package names starting with this base package. The Windows API data structures and functions are assigned to packages such as
windows.win32.ui.windowsandmessaging. The base package is prepended. The default is an empty string, i.e., no additional package name.- Returns:
- the base package name
-
setBasePackage
Sets the base package for the generated code.The generated code will have package names starting with this base package. The Windows API data structures and functions are assigned to packages such as
windows.win32.ui.windowsandmessaging. The base package is prepended. A valid package name looks likecom.company.product. The default is an empty string, i.e., no additional package name.- Parameters:
basePackage- base package name
-
getStructs
-
setStructs
-
getFunctions
-
setFunctions
Sets the names of the Windows API functions to generate.Note that if an ANSI and Unicode version of a function exists, the exact version must be specified. ANSI versions usually end with the uppercase A while Unicode versions end in the uppercase W.
- Parameters:
functions- the function names
-
getEnumerations
-
setEnumerations
-
getCallbackFunctions
-
setCallbackFunctions
-
getComInterfaces
-
setComInterfaces
-
getConstants
-
setConstants
-
getEventListener
Gets the event listener.The event listener is notified about events such as code generation progress or validation errors.
- Returns:
- the event listener
-
setEventListener
Sets the event listener.The event listener is notified about events such as code generation progress or validation errors.
- Parameters:
eventListener- the event listener
-
generateCode
public void generateCode()Generates the code. -
dryRun
public void dryRun()Executes a dry run.A dry run does not write or delete any files or directories.
-
createDirectory
Creates the specified directory.- Parameters:
path- path of directory
-
cleanOutputDirectory
public void cleanOutputDirectory()Cleans the output directory.All files in the directory are deleted but not the directory itself.
-