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


Java JavaClass.getFieldByName方法代码示例

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


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

示例1: arrayRequiredAppearsInFieldJavadoc

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

    schemaRule.generateAndCompile("/schema/javaName/javaNameWithRequiredProperties.json", "com.example.required");
    File generatedJavaFileWithRequiredProperties = schemaRule.generated("com/example/required/JavaNameWithRequiredProperties.java");

    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFileWithRequiredProperties);

    JavaClass classWithRequiredProperties = javaDocBuilder.getClassByName("com.example.required.JavaNameWithRequiredProperties");

    JavaField javaFieldWithoutJavaName = classWithRequiredProperties.getFieldByName("requiredPropertyWithoutJavaName");
    JavaField javaFieldWithJavaName = classWithRequiredProperties.getFieldByName("requiredPropertyWithoutJavaName");

    assertThat(javaFieldWithoutJavaName.getComment(), containsString("(Required)"));
    assertThat(javaFieldWithJavaName.getComment(), containsString("(Required)"));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:JavaNameIT.java

示例2: inlineRequiredAppearsInFieldJavadoc

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

    schemaRule.generateAndCompile("/schema/javaName/javaNameWithRequiredProperties.json", "com.example.required");
    File generatedJavaFileWithRequiredProperties = schemaRule.generated("com/example/required/JavaNameWithRequiredProperties.java");

    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFileWithRequiredProperties);

    JavaClass classWithRequiredProperties = javaDocBuilder.getClassByName("com.example.required.JavaNameWithRequiredProperties");

    JavaField javaFieldWithoutJavaName = classWithRequiredProperties.getFieldByName("inlineRequiredPropertyWithoutJavaName");
    JavaField javaFieldWithJavaName = classWithRequiredProperties.getFieldByName("inlineRequiredPropertyWithoutJavaName");

    assertThat(javaFieldWithoutJavaName.getComment(), containsString("(Required)"));
    assertThat(javaFieldWithJavaName.getComment(), containsString("(Required)"));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:JavaNameIT.java

示例3: visit

import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
@Override
public Object visit(FieldRef fieldRef) {
	try {
		return super.visit(fieldRef);
	} catch (IllegalArgumentException iae) {
		// let's try again! (some refs are not found unfortunately ...)
		JavaPackage currentPackage = context.getPackage();
		JavaClass targetClass = null;
		for (JavaClass c : currentPackage.getClasses()) {
			if (c.getName().equals(fieldRef.getNamePart(0))) {
				targetClass = c;
			}
		}

		if (targetClass == null) throw iae;

		JavaField field = targetClass.getFieldByName(fieldRef.getNamePart(1));
		return getFieldReferenceValue(field);
	}
}
 
开发者ID:Maddoc42,项目名称:JaxRs2Retrofit,代码行数:21,代码来源:SimpleEvaluatingVisitor.java

示例4: originalPropertyNamesAppearInJavaDoc

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

    schemaRule.generateAndCompile("/schema/javaName/javaName.json", "com.example.javaname");
    File generatedJavaFile = schemaRule.generated("com/example/javaname/JavaName.java");

    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFile);

    JavaClass classWithDescription = javaDocBuilder.getClassByName("com.example.javaname.JavaName");

    JavaField javaPropertyField = classWithDescription.getFieldByName("javaProperty");
    assertThat(javaPropertyField.getComment(), containsString("Corresponds to the \"propertyWithJavaName\" property."));

    JavaField javaEnumField = classWithDescription.getFieldByName("javaEnum");
    assertThat(javaEnumField.getComment(), containsString("Corresponds to the \"enumWithJavaName\" property."));

    JavaField javaObjectField = classWithDescription.getFieldByName("javaObject");
    assertThat(javaObjectField.getComment(), containsString("Corresponds to the \"objectWithJavaName\" property."));

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

示例5: expand

import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
private String expand(JavaClass javaClass, String value) {
    JavaField field = javaClass.getFieldByName(value);
    return field == null ? stripQuotes(value) :
            stripQuotes(field.getCodeBlock().replaceFirst(".*=", "").replaceFirst(";$", ""));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:OnosCfgMojo.java


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