| Crates.io | codegraph-java |
| lib.rs | codegraph-java |
| version | 0.1.0 |
| created_at | 2026-01-18 08:48:14.675973+00 |
| updated_at | 2026-01-18 08:48:14.675973+00 |
| description | Java parser for CodeGraph - extracts code entities and relationships from Java source files |
| homepage | |
| repository | https://github.com/anvanster/codegraph |
| max_upload_size | |
| id | 2052066 |
| size | 114,872 |
Java parser for CodeGraph - extracts code entities and relationships from Java source files.
use codegraph_java::JavaParser;
use codegraph_parser_api::CodeParser;
use codegraph::CodeGraph;
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut graph = CodeGraph::in_memory()?;
let parser = JavaParser::new();
let file_info = parser.parse_file(Path::new("Main.java"), &mut graph)?;
println!("Parsed {} functions", file_info.functions.len());
println!("Parsed {} classes", file_info.classes.len());
Ok(())
}
| Java Construct | Maps To |
|---|---|
class |
ClassEntity |
interface |
TraitEntity |
enum |
ClassEntity (with "enum" attribute) |
record |
ClassEntity (with "record" attribute) |
method |
FunctionEntity |
constructor |
FunctionEntity |
package |
Used for qualified names |
import |
ImportRelation |
extends (class) |
InheritanceRelation |
implements |
ImplementationRelation |
Apache-2.0