当前位置: 首页>>代码示例>>Java>>正文


Java JavaField.getComment方法代码示例

本文整理汇总了Java中com.thoughtworks.qdox.model.JavaField.getComment方法的典型用法代码示例。如果您正苦于以下问题:Java JavaField.getComment方法的具体用法?Java JavaField.getComment怎么用?Java JavaField.getComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thoughtworks.qdox.model.JavaField的用法示例。


在下文中一共展示了JavaField.getComment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateKeyTableFromSources

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
/**
 * Example for getting comments from a java file using qdox.
 * This requires access to the actual java file in the list of ressources.
 * (Use source folder as output folder for class files in eclipse)
 */
private void generateKeyTableFromSources(){
	// read java sources to parser from qdox
	InputStream stream = RegKeys.class.getResourceAsStream("RegKeys.java");
	InputStreamReader reader = new InputStreamReader(stream);
	JavaDocBuilder builder = new JavaDocBuilder();
	builder.addSource(reader);
	
	// generate table with line wrapping cells in colum 2
	final int wordWrapColumnIndex = 1;
	descTable = new JTable() {    
		/**
		 * 
		 */
		private static final long serialVersionUID = 7516482246121817003L;

		public TableCellRenderer getCellRenderer(int row, int column) {
			if (column == wordWrapColumnIndex ) {
				return new MultilineTableCell();
			}
			else {
				return super.getCellRenderer(row, column);
			}
		}
	};
	
	// Use qdox parser to parse RegKeys sources
	JavaClass cls = builder.getClassByName("edu.stanford.rsl.conrad.utils.RegKeys");
	// get list of fields
	JavaField[] fields = cls.getFields();

	// build table model
	String [][] tableData = new String [fields.length][2];
	String [] label = {"Key", "Description"};
	int i = 0;
	for (JavaField field : fields){
		tableData[i][0] = field.getName();
		tableData[i][1] = field.getComment();
		if (tableData[i][1] != null){
			tableData[i][1] = field.getComment().replace("<BR>", "\n")	
			.replace("<br>", "\n")
			.replace("<b>", "\n")
			.replace("</b>", "\n");
		} else {
			tableData[i][1] = "";
		}
		i++;
	}

	DefaultTableModel model = new DefaultTableModel(tableData, label);
	descTable.setModel(model);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:57,代码来源:RegistryEditor.java

示例2: requiredAppearsInFieldJavadoc

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
@Test
public void requiredAppearsInFieldJavadoc() throws IOException {

    JavaField javaField = classWithRequired.getFieldByName("requiredProperty");
    String javaDocComment = javaField.getComment();

    assertThat(javaDocComment, containsString("(Required)"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequiredIT.java

示例3: nonRequiredFiedHasNoRequiredText

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
@Test
public void nonRequiredFiedHasNoRequiredText() throws IOException {

    JavaField javaField = classWithRequired.getFieldByName("nonRequiredProperty");
    String javaDocComment = javaField.getComment();

    assertThat(javaDocComment, not(containsString("(Required)")));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequiredIT.java

示例4: notRequiredIsTheDefault

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
@Test
public void notRequiredIsTheDefault() throws IOException {

    JavaField javaField = classWithRequired.getFieldByName("defaultNotRequiredProperty");
    String javaDocComment = javaField.getComment();

    assertThat(javaDocComment, not(containsString("(Required)")));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequiredIT.java

示例5: descriptionAppearsInFieldJavadoc

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
@Test
public void descriptionAppearsInFieldJavadoc() throws IOException {

    JavaField javaField = classWithTitle.getFieldByName("title");
    String javaDocComment = javaField.getComment();

    assertThat(javaDocComment, containsString("A title for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:TitleIT.java

示例6: titleAppearsBeforeDescriptionInJavadoc

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
@Test
public void titleAppearsBeforeDescriptionInJavadoc() throws IOException {

    JavaField javaField = classWithTitle.getFieldByName("titleAndDescription");
    String javaDocComment = javaField.getComment();

    assertThat(javaDocComment, containsString("A description for this property"));
    assertThat(javaDocComment.indexOf("A title for this property"), is(lessThan(javaDocComment.indexOf("A description for this property"))));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:TitleIT.java

示例7: descriptionAppearsInFieldJavadoc

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
@Test
public void descriptionAppearsInFieldJavadoc() throws IOException {

    JavaField javaField = classWithDescription.getFieldByName("description");
    String javaDocComment = javaField.getComment();

    assertThat(javaDocComment, containsString("A description for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DescriptionIT.java

示例8: descriptionAppearsAfterTitleInJavadoc

import com.thoughtworks.qdox.model.JavaField; //导入方法依赖的package包/类
@Test
public void descriptionAppearsAfterTitleInJavadoc() throws IOException {

    JavaField javaField = classWithDescription.getFieldByName("descriptionAndTitle");
    String javaDocComment = javaField.getComment();

    assertThat(javaDocComment, containsString("A title for this property"));
    assertThat(javaDocComment.indexOf("A description for this property"), is(greaterThan(javaDocComment.indexOf("A title for this property"))));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DescriptionIT.java


注:本文中的com.thoughtworks.qdox.model.JavaField.getComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。