如何根据Java类的API文档使用它

发布于 2024-11-07 01:50:44 字数 442 浏览 6 评论 0原文

我对 Java 很陌生,需要从事一个需要使用开源软件的项目。我对理解那些 Java API 的文档感到非常困惑。 作为示例,您能否向我展示如何基于 Java API 使用相关的 java 类 RemoteXmlSimpleSearchEngineBase。

请参考这个链接 http://download.carrot2.org/stable/javadoc /org/carrot2/source/xml/RemoteXmlSimpleSearchEngineBase.html

我对这个推导过程非常感兴趣,这样我就可以在阅读其API文档的基础上使用其他java类。谢谢。

I am quite new to Java, and need to work on a project requiring using open source software. I am very confusing about understanding those Java API's documentation.
As an example, can you show me how to use the related java class, RemoteXmlSimpleSearchEngineBase, based on its Java API.

Please refer to this link
http://download.carrot2.org/stable/javadoc/org/carrot2/source/xml/RemoteXmlSimpleSearchEngineBase.html

I am very interested in this derivation process, so that I can use other java classes based on reading its API documentation. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

感情旳空白 2024-11-14 01:50:44

通常,JavaDoc 不会解释库的一般概念,而只是解释该类的 API。它可能包含更多有用的信息(如 JDK JavaDocs 所做的那样),但一般来说,您应该尝试获取用户手册、参考或入门指南。

从JavaDoc中你仍然可以学到一些东西:

  1. 实现了哪些接口,
  2. 存在哪些直接已知的子类/实现者,
  3. 你看到该类是抽象的,
  4. 该类添加/覆盖了哪些方法
  5. ,添加了哪些
  6. 方法的前置/后置条件以及它的参数(有时没有列出)
  7. ...

但是,您通常不了解一般概念,或者何时调用方法,如何为各种用例配置类等。您根本无法将所有这些都放入 API 中文档。

Often the JavaDoc doesn't explain the general concept of a library but just the API for that class. It might contain more useful information (like the JDK JavaDocs do), but in general you should try to get a user manual, reference or getting started guide.

From the JavaDoc you can still learn a few things:

  1. what interfaces are implemented
  2. which directly known subclasses/implementors exist
  3. you see that the class is abstract
  4. which methods are added/overridden by that class
  5. which methods are added
  6. pre-/postconditions of the methods and its parameters (sometimes not listed)
  7. ...

However, you often don't get the general concept or when a method is called, how to configure a class for various use cases etc. You simply can't put that all into an API documention.

冷夜 2024-11-14 01:50:44

也许您应该查看项目文档:

http://project.carrot2.org/documentation.html< /a>

您有一些示例和大量信息。

Maybe you should take a look to the project documentation:

http://project.carrot2.org/documentation.html

You have some examples and lot of information.

妥活 2024-11-14 01:50:44

当我试图了解某些 API 时,我经常发现有用的是类/接口树,甚至更多的是“使用”页面 - 它们显示哪些其他类/接口在其 API 中使用此类/接口。这展示了如何获取某种类型的对象(通过查找返回值),或者如何处理某些对象(除了使用其方法本身)。

遗憾的是,后者不是默认生成的(并且在您问题的示例中也缺失)。

What I often find useful when trying to get an overview over some API are the class/interface trees, and even more the "Usage" pages - they show which other classes/interfaces use this class/interface in their API. This shows how to get some type of object (by finding return values), or what to do with some object (except from using its methods itself).

Sadly, the latter ones are not generated by default (and also missing in the example in your question).

溺孤伤于心 2024-11-14 01:50:44

很多时候,JavaDoc 概述页面会提供一些 API 概述和代码示例。 Carrot2 JavaDoc 的情况实际上就是这样:

http://download.carrot2。 org/stable/javadoc/overview-summary.html#overview_description

Very often, the JavaDoc overview page will have some overview of the API and code examples. This is actually the case with Carrot2 JavaDoc:

http://download.carrot2.org/stable/javadoc/overview-summary.html#overview_description

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文