本文整理汇总了Java中japa.parser.ast.expr.AnnotationExpr.setComment方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationExpr.setComment方法的具体用法?Java AnnotationExpr.setComment怎么用?Java AnnotationExpr.setComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类japa.parser.ast.expr.AnnotationExpr
的用法示例。
在下文中一共展示了AnnotationExpr.setComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnnotationNodes
import japa.parser.ast.expr.AnnotationExpr; //导入方法依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
final FieldDescriptor fd = OjbUtil.findFieldDescriptor(mappedClass, fieldName, descriptorRepositories);
if (fd != null) {
final Class<?> fc = ResolverUtil.getType(enclosingClass, fieldName);
if (isEnum(fc)) {
final Comment fixme = new BlockComment("\nFIXME:\n" +
"Enums must be annotated with the @Enumerated annotation.\n " +
"The @Enumerated annotation should set the EnumType.\n" +
"If the EnumType is not set, then the Enumerated annotation is defaulted to EnumType.ORDINAL.\n" +
"This conversion program cannot tell whether EnumType.ORDINAL is the appropriate EnumType.");
AnnotationExpr enumerated = new NormalAnnotationExpr(new NameExpr(SIMPLE_NAME), Collections.singletonList(new MemberValuePair("value", new NameExpr("EnumType."))));
enumerated.setComment(fixme);
return new NodeData(enumerated, new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "TemporalType"), false, false)));
}
}
return null;
}
示例2: getAnnotationNodes
import japa.parser.ast.expr.AnnotationExpr; //导入方法依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass);
if (joinColumns != null && joinColumns.size() > 1) {
final Comment fixme = new BlockComment("\nFIXME: JPA_CONVERSION\n"
+ "For compound primary keys, make sure the join columns are in the correct order.\n");
AnnotationExpr
annotation = new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new ArrayInitializerExpr(joinColumns));
annotation.setComment(fixme);
return new NodeData(annotation,
new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
Arrays.asList(
new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PrimaryKeyJoinColumnResolver.PACKAGE),PrimaryKeyJoinColumnResolver.SIMPLE_NAME), false, false)
, new ImportDeclaration(new QualifiedNameExpr(new NameExpr(JoinColumnResolver.PACKAGE),JoinColumnResolver.SIMPLE_NAME), false, false)
));
}
return null;
}
示例3: getAnnotationNodes
import japa.parser.ast.expr.AnnotationExpr; //导入方法依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass);
if (joinColumns != null && joinColumns.size() > 1) {
final Comment fixme = new BlockComment("\nFIXME: JPA_CONVERSION\n"
+ "For compound primary keys, make sure the join columns are in the correct order.\n");
AnnotationExpr annotation = new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new ArrayInitializerExpr(joinColumns));
annotation.setComment(fixme);
return new NodeData(annotation,
new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "PrimaryKeyJoinColumn"), false, false)));
}
return null;
}