CADI Java Atomizer
Example extension that demonstrates how to create a language atomizer for CADI.
Overview
This extension provides Java language support for CADI by:
- Extracting atomic chunks from Java source code (classes, methods)
- Resolving Java import statements
- Supporting Java-specific syntax and patterns
Building
This will create a dynamic library that can be loaded by CADI.
Usage
-
Copy the built library to your CADI extensions directory:
-
CADI will automatically load the extension on startup.
Extension Structure
java-atomizer/
├── extension.toml # Extension manifest
├── libextension.so # Compiled extension library
└── src/
└── lib.rs # Extension implementation
Implementation Details
The Java atomizer uses regex patterns to:
- Extract class definitions and their bodies
- Extract method definitions within classes
- Resolve import statements
Each extracted atom includes:
- Unique ID based on language and type
- Content type (
text/java) - Metadata (language, type, name, class)
- Dependencies (parent classes/methods)
- Content hash for deduplication
Testing
This would be atomized into:
- Class atom:
Exampleclass definition - Method atoms: constructor and
getName()method