Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在javadoc代码块中显示泛型?_Java_Generics_Javadoc - Fatal编程技术网

如何在javadoc代码块中显示泛型?

如何在javadoc代码块中显示泛型?,java,generics,javadoc,Java,Generics,Javadoc,我有一个javadoc代码块,我想在其中编写一个代码示例,其中包括以下泛型: public interface SomeInterface <T> { } public interface SomeInterface extends SomeOtherInterface<T> { } 输出中缺少泛型 如何让javadoc正确显示泛型?如何 /** * Get the Generic Type T of a Type (Class/Interface) or ex

我有一个javadoc代码块,我想在其中编写一个代码示例,其中包括以下泛型:

public interface SomeInterface <T> { }
public interface SomeInterface extends SomeOtherInterface<T> { }
输出中缺少泛型

如何让javadoc正确显示泛型?

如何

 /**
   * Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype: 
   * <pre>
   * {@code
   * public interface SomeInterface &lt;T&gt; { }
   * public interface SomeInterface extends SomeOtherInterface&lt;T&gt; { }
   * }
   * </pre>
   * @param implType
   * @param parentType
   * @return
   */
/**
*解释一下。。。
* 
*公共接口SomeInterface T{}
* 
*/
这是因为JavaDoc呈现为HTML,因此必须转义
,才能正确呈现


编辑:在OP的澄清之后,我更改了答案。

Java文档被呈现为HTML,因此尖括号(
)之间的任何内容都将被解释为HTML标记,而不会打印为文本。 您可以使用
分别呈现HTML

/**
*获取类型(类/接口)或扩展/继承子类型的泛型类型T:
* 
*{@code
*公共接口SomeInterface T{}
*公共接口SomeInterface扩展了SomeOtherInterfaceT{}
* }
* 
*@param implType
*@param父类型
*@返回
*/

JavaDoc使用html进行渲染。因此,如果希望左角括号()出现在JavaDoc中,则需要对左角括号使用
,对右角括号使用
。例如:

/**
*获取类型(类/接口)或扩展/继承子类型的泛型类型T:
* 
*{@code
*公共接口SomeInterface T{}
*公共接口SomeInterface扩展了SomeOtherInterfaceT{}
* }
* 
*@param implType
*@param父类型
*@返回
*/

有关更多详细信息,请参阅。

实际上,您可以将泛型放入javadoc本身。我知道这不是有效的HTML,我假设javadoc处理器对它有特殊的案例处理

以您的例子:

/**
*@param类型
*/
公共接口SomeInterface{}


来源:

我想在我的JavaDoc中编写一个代码示例,而不是你所做的?
Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype:


 public interface SomeInterface  { }
 public interface SomeInterface extends SomeOtherInterface { }
 }

Parameters:
implType
parentType
Returns:
/**
 * Explain something...
 * <pre>
 * public interface SomeInterface &lt;T&gt; { }
 * </pre>
 */
 /**
   * Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype: 
   * <pre>
   * {@code
   * public interface SomeInterface &lt;T&gt; { }
   * public interface SomeInterface extends SomeOtherInterface&lt;T&gt; { }
   * }
   * </pre>
   * @param implType
   * @param parentType
   * @return
   */
/**
* Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype: 
* <pre>
* {@code
* public interface SomeInterface &lt;T&gt; { }
* public interface SomeInterface extends SomeOtherInterface&lt;T&gt; { }
* }
* </pre>
* @param implType
* @param parentType
* @return
*/