多行代码的Javadoc格式问题

时间:2015-06-20 20:40:52

标签: java javadoc

我有以下Javadoc,它有多行代码:

     * <p>Usage example:
 * <code>
 *  ConfigurationProperty property = ConfigurationProperty.Builder
 *                                      .create()
 *                                      .withHotKey("testKey")
 *                                  .withRunnableContext("testContext")
 *                                  .withRunnableContextType("APPLICATION")
 *                                  .build();
 * </code>
 * 
 * The {@link ConfigurationProperty.Builder#withRunnableContextType(String type) method 
 * throws an {@link IllegalArgumentException} if the provided type is not supported in
 * {@link ConfigurationProperty#RUNNABLE_CONTEXT_TYPE}

我的问题是代码没有在生成的Javadoc中显示右缩进。以下是我在生成的Javadoc中看到的没有任何缩进的内容:

Immutable implementation of a ConfigurationProperty. This class is  
 immutable, and so is thread safe. An instance of the ConfigurationProperty
can be obtained by using the ConfigurationProperty.Builder 

Usage example: ConfigurationProperty property =    
ConfigurationProperty.Builder .create() .withHotKey("testKey")   
.withRunnableContext("testContext") .withRunnableContextType("APPLICATION")   
.build(); } The method throws an IllegalArgumentException if the provided 
type is not supported in ConfigurationProperty.RUNNABLE_CONTEXT_TYPE

如果我用pre标签替换代码,那么只显示第一行代码。 enter image description here  为什么会如此。我该如何解决? 关于如何纠正这个的任何想法?

请指教,

谢谢!

1 个答案:

答案 0 :(得分:0)

使用<pre>代替<code>

enter image description here