/**
* Generates a reference to a class instance, appropriately hyperlinked.
* @param classInstance the class instance to link to.
*/
private void generateClassInstanceReference(ClassInstance classInstance) {
ModuleName definingModuleName = classInstance.getModuleName();
ClassInstanceIdentifier identifier = classInstance.getIdentifier();
String classInstanceLabel = labelMaker.getClassInstanceLabel(identifier);
if (!isDocForClassInstanceGenerated(classInstance)) {
// if the class instance is not documented, no hyperlink can be made.
generateClassInstanceDeclarationName(classInstance, false);
} else {
// the instance is indeed documented, so create a hyperlinked reference to it
HTMLBuilder.AttributeList hrefAttribute;
if (config.shouldSeparateInstanceDoc) {
if (inSeparateInstanceDoc) {
if (definingModuleName == null || definingModuleName.equals(currentModuleName)) {
hrefAttribute = localHrefAttribute(classInstanceLabel);
} else {
hrefAttribute = nonLocalHrefAttribute(getSeparateInstanceDocFileName(definingModuleName), classInstanceLabel);
}
} else {
hrefAttribute = nonLocalHrefAttribute("../" + SEPARATE_INSTANCE_DOC_SUBDIRECTORY + "/" + getSeparateInstanceDocFileName(definingModuleName), classInstanceLabel);
}
} else {
if (definingModuleName == null || definingModuleName.equals(currentModuleName)) {
hrefAttribute = localHrefAttribute(classInstanceLabel);
} else {
hrefAttribute = nonLocalHrefAttribute(getModuleFileName(definingModuleName), classInstanceLabel);
}
}