gpt4 book ai didi

Android 示例评论 BEGIN_INCLUDE END_INCLUDE

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:28:28 26 4
gpt4 key购买 nike

在阅读一些 android 示例时,我通常会看到像

这样的评论
// BEGIN_INCLUDE (something)
// END_INCLUDE (something)

但是,我当前的 IDE——Android Studio 1.1——无法识别它们(或者我做错了什么)。我猜,它们用作某种代码区域标记(例如

//<editor-fold desc="Region name"> 
// some code
//</editor-fold>

在 AndroidStudio/IntellijIDEA 中),但这种语法很像 C++ 预处理器指令。所以问题是:我是否应该了解这些注释的一些重要信息(除了明显的注释功能之外)可以以任何方式改进我的代码?

最佳答案

它用于文档目的,用于识别要包含在目标文档中的 fragment 。它在编辑代码时并不是很有用;它有助于通过从实际代码生成文档来避免重复。

{@sample} and {@include}

These tags copy sample text from an arbitrary file into the output javadoc html.

The @include tag copies the text verbatim from the given file.

The @sample tag

  • copies the text from the given file and strips leading and trailing whitespace
  • reduces the indent level of the text to the indent level of the first non-whitespace line
  • escapes all <, >; and & characters for html
  • drops all lines containing either BEGIN_INCLUDE or END_INCLUDE so sample code can be nested

Both tags accept either a filename and an id or just a filename. If no id is provided, the entire file is copied. If an id is provided, the lines in the given file between the first two lines containing BEGIN_INCLUDE(id) and END_INCLUDE(id), for the given id, are copied. The id may be only letters, numbers and underscore ().

Four examples:

{@include samples/SampleCode/src/com/google/app/Notification1.java}
{@sample samples/SampleCode/src/com/google/app/Notification1.java}
{@include samples/SampleCode/src/com/google/app/Notification1.java Bleh}
{@sample samples/SampleCode/src/com/google/app/Notification1.java Bleh}

https://code.google.com/p/doclava/wiki/JavadocTags

关于Android 示例评论 BEGIN_INCLUDE END_INCLUDE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29094073/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com