/**
* Create new <tt>XmlSeeAlso</tt> annotation.
* @param file Javassist file to work with
* @param types The class to refer to
* @return The annotation
*/
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
private static Annotation xmlSeeAlso(final ClassFile file,
final Collection<Class<?>> types) {
final Annotation annotation = new Annotation(
XmlSeeAlso.class.getName(),
file.getConstPool()
);
final ArrayMemberValue member = new ArrayMemberValue(
file.getConstPool()
);
final ClassMemberValue[] values = new ClassMemberValue[types.size()];
int pos = 0;
for (final Class<?> type : types) {
values[pos] = new ClassMemberValue(
type.getName(),
file.getConstPool()
);
pos += 1;
}
member.setValue(values);
annotation.addMemberValue("value", member);
Logger.debug(
JaxbGroup.class,
"#xmlSeeAlso(.., %d classes): annotation created",
types.size()
);
return annotation;
}
JaxbGroup.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:rexsl
作者:
评论列表
文章目录