本文整理汇总了Java中org.jboss.forge.roaster.model.source.FieldSource.getAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java FieldSource.getAnnotations方法的具体用法?Java FieldSource.getAnnotations怎么用?Java FieldSource.getAnnotations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.forge.roaster.model.source.FieldSource
的用法示例。
在下文中一共展示了FieldSource.getAnnotations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.jboss.forge.roaster.model.source.FieldSource; //导入方法依赖的package包/类
public void visit(FieldSource<? extends JavaSource> fieldSource) {
Type fieldType = fieldSource.getType();
String fieldClassName;
// the javadoc for Named.getName() is misleading:
// the FieldSource.getName() (which is implemented by FieldImpl.getName())
// returns the (fully-qualified!) name of the field
String fieldName = fieldSource.getName();
resParts.addPart(fieldName,
PartType.FIELD);
if (fieldType.isPrimitive()) {
fieldClassName = fieldType.getName();
} else {
fieldClassName = fieldType.getQualifiedName();
}
addJavaResourceReference(fieldClassName);
// Field annotations
for (AnnotationSource annoSource : fieldSource.getAnnotations()) {
visit(annoSource);
}
}
示例2: visit
import org.jboss.forge.roaster.model.source.FieldSource; //导入方法依赖的package包/类
public void visit(FieldSource<? extends JavaSource> fieldSource) {
Type fieldType = fieldSource.getType();
String fieldClassName;
// the javadoc for Named.getName() is misleading:
// the FieldSource.getName() (which is implemented by FieldImpl.getName())
// returns the (fully-qualified!) name of the field
String fieldName = fieldSource.getName();
resParts.addPart(fieldName, PartType.FIELD);
try {
if (DriverUtils.isManagedType(fieldType, classTypeResolver)) {
if (fieldType.isPrimitive()) {
fieldClassName = fieldType.getName();
} else if (DriverUtils.isSimpleClass(fieldType)) {
fieldClassName = classTypeResolver.getFullTypeName(fieldType.getName());
} else {
//if this point was reached, we know it's a Collection.
// Managed type check was done previously.
Type elementsType = ((List<Type>) fieldType.getTypeArguments()).get(0);
fieldClassName = classTypeResolver.getFullTypeName(elementsType.getName());
}
} else {
// mriet: not complete sure why we don't just do this instead of using DriverUtils?
fieldClassName = fieldType.getQualifiedName();
}
addJavaResourceReference(fieldClassName);
} catch (Exception e) {
logger.error("Unable to index java class field for class: " + javaSource.getQualifiedName() + ", fieldName: " + fieldName + " fieldType: " + fieldType);
}
// Field annotations
for (AnnotationSource annoSource : fieldSource.getAnnotations()) {
visit(annoSource);
}
}