}
}
private static String getSerializedLinkFromTag(final SeeTag linkTag) {
final MemberDoc referencedMember = linkTag.referencedMember();
if (referencedMember == null) {
throw new NullPointerException("Referenced member of @link " + print(linkTag) + " cannot be resolved.");
}
if (!referencedMember.isStatic()) {
LOG.warning("Referenced member of @link " + print(linkTag) + " is not static." +
" Right now only references to static members are supported.");
return null;
}
/* Get referenced example bean
*/
final ClassDoc containingClass = referencedMember.containingClass();
final Object object;
try {
final Field declaredField = Class.forName(containingClass.qualifiedName(), false, Thread.currentThread()
.getContextClassLoader()).getDeclaredField(referencedMember.name());
if (referencedMember.isFinal()) {
declaredField.setAccessible(true);
}
object = declaredField.get(null);
LOG.log(Level.FINE, "Got object " + object);
} catch (final Exception e) {
LOG.info("Have classloader: " + ResourceDoclet.class.getClassLoader().getClass());
LOG.info("Have thread classloader " + Thread.currentThread().getContextClassLoader().getClass());
LOG.info("Have system classloader " + ClassLoader.getSystemClassLoader().getClass());
LOG.log(Level.SEVERE, "Could not get field " + referencedMember.qualifiedName(), e);
return null;
}
/* marshal the bean to xml
*/