以编程方式编写Java

编程入门 行业动态 更新时间:2024-10-25 08:26:51
本文介绍了以编程方式编写Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道是否已经有一个库可以以编程方式编写Java类或方法?

I was wondering if there is already a library to programmatically write a java class or method?

我正在寻找能够将新源代码写入现有文件的库或扩展已经存在的文件。

I am looking for libraries capable of writing new source code into existing files or extend files that already exist.

推荐答案

查看 Eclipse JDT 。

Eclipse Java开发工具(JDT)提供用于访问和操作Java源代码的API。它允许访问工作空间中的现有项目,创建新项目以及修改和读取现有项目。

The Eclipse Java Development Tools (JDT) provide APIs to access and manipulate Java source code. It allows to access the existing projects in the workspace, create new projects and modify and read existing projects.

更具体地说,您可以创建新的Java元素,例如项目,程序包,类,然后使用Java模型API,然后您可以创建/修改类型为以下内容的内容:方法,通过AST的语句(抽象语法树)

More specifically, you can create new Java elements e.g. projects, packages, classes using the Java Model API and then you can then create/modify contents of a type e.g. methods, statements via the AST (Abstract Syntax Tree)

您应该看到此文章以及此教程。

You should see this article and also this tutorial.

更多推荐

以编程方式编写Java

本文发布于:2023-11-28 13:25:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642587.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方式   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!