Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pascalgn/java-model
https://github.com/pascalgn/java-model
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/pascalgn/java-model
- Owner: pascalgn
- License: mit
- Created: 2022-02-26T19:18:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-16T11:11:56.000Z (27 days ago)
- Last Synced: 2024-10-18T00:57:15.535Z (26 days ago)
- Language: TypeScript
- Size: 195 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# java-model
[![npm version](https://img.shields.io/npm/v/java-model.svg?style=flat-square)](https://www.npmjs.com/package/java-model)
Provides high-level access to the Java type model, based on [java-ast](https://github.com/pascalgn/java-ast).
## Usage
```java
class A {
private int i;
}record B(String s) {
}enum C { C1, C2 }
``````typescript
import { readFileSync } from "node:fs";
import { parse } from "java-model";const project = parse({
files: ["input.java"],
read: (file) => readFileSync(file, "utf8")
});project.visitTypes((type) => {
console.log(type.name);
console.log(type.qualifiedName);
console.log(type.properties());
});
```## License
[MIT](LICENSE)