package com.dhemery.express;

import org.hamcrest.SelfDescribing;
import org.hamcrest.StringDescription;
import org.hamcrest.internal.SelfDescribingValue;

/**
 * Describes an object, preferring the object's description of itself.
 */
public class BestDescription {
    /**
     * Returns the item's description of itself.
     *
     * @param item
     *         the item to describe
     *
     * @return the item's description of itself
     */
    public static String of(SelfDescribing item) {
        return StringDescription.toString(item);
    }

    /**
     * Returns a description of the item. If the item is an instance of {@code
     * SelfDescribing}, its self-description is returned. Otherwise, the
     * description is as formatted by {@link StringDescription#appendValue}.
     *
     * @param item
     *         the item to describe
     *
     * @return a description of the item
     */
    public static String of(Object item) {
        return BestDescription.of(selfDescribing(item));
    }

    private static SelfDescribing selfDescribing(Object item) {
        if (item instanceof SelfDescribing) return (SelfDescribing) item;
        return new SelfDescribingValue<>(item);
    }
}

@@ -617,36 +617,14 @@
  is 
-an instance of %7B@code%0A     *
+%7B@link
  Sel
@@ -636,16 +636,23 @@
 ribing%7D,
+%0A     *
  its sel
@@ -692,23 +692,16 @@
 ise, the
-%0A     *
  descrip
@@ -710,16 +710,23 @@
 on is as
+%0A     *
  formatt

Update BestDescription doc