public DocRefCell<T> build() {
            if (docRefFunction == null) {
                docRefFunction = v -> null;
            }
            if (cellTextFunction == null) {
                cellTextFunction = v -> {
                    final DocRef docRef = docRefFunction.apply(v);
                    if (docRef == null) {
                        return SafeHtmlUtils.EMPTY_SAFE_HTML;
                    } else {
                        final String displayValue = docRef.getDisplayValue(NullSafe.requireNonNullElse(
                                displayType,
                                DisplayType.AUTO));
                        return NullSafe.isNonBlankString(displayValue)
                                ? SafeHtmlUtils.fromString(displayValue)
                                : SafeHtmlUtils.EMPTY_SAFE_HTML;
                    }
                };
            }
            if (cssClassFunction == null) {
                cssClassFunction = v -> null;
            }

//
//                public static String getTextFromDocRef(final DocRef docRef) {
//                    return getTextFromDocRef(docRef, DisplayType.AUTO);
//                }
//
//                public static String getTextFromDocRef(final DocRef docRef, final DisplayType displayType) {
//                    if (docRef == null) {
//                        return null;
//                    } else {
//                        return docRef.getDisplayValue(NullSafe.requireNonNullElse(displayType, DisplayType.AUTO));
//                    }
//                }
//
//            }
//
//
//
//        } else if (docRef != null) {
//            cellHtmlText = SafeHtmlUtils.fromString(getTextFromDocRef(docRef, displayType));
//        } else {
//            cellHtmlText = SafeHtmlUtils.EMPTY_SAFE_HTML;
//        }


            return new DocRefCell<>(
                    eventBus,
                    allowLinkByName,
                    showIcon,
                    cellTextFunction,
                    docRefFunction,
                    cssClassFunction);
        }
@param showIcon         Set to true to show the type icon next to the text
@param cellTextFunction Function to provide the cell 'text' in HTML form.
@param docRefFunction   Function to provide a doc ref if the value can give us one.
@param cssClassFunction Function to provide additional css class names.
stroom-core-client/src/main/java/stroom/data/client/presenter/DocRefCell.java