package com.dhemery.express;

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

public class BestDescription {
    public static String of(SelfDescribing item) {
        return StringDescription.toString(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);
    }
}

@@ -153,145 +153,761 @@
 e;%0A%0A
-public class BestDescription %7B%0A    public static String of(SelfDescribing item) %7B%0A        return StringDescription.toString(item);%0A    %7D%0A
+/**%0A * Describes an object, preferring the object's description of itself.%0A */%0Apublic class BestDescription %7B%0A    /**%0A     * Returns the item's description of itself.%0A     *%0A     * @param item%0A     *         the item to describe%0A     *%0A     * @return the item's description of itself%0A     */%0A    public static String of(SelfDescribing item) %7B%0A        return StringDescription.toString(item);%0A    %7D%0A%0A    /**%0A     * Returns a description of the item. If the item is an instance of %7B@code%0A     * SelfDescribing%7D, its self-description is returned. Otherwise, the%0A     * description is as formatted by %7B@link StringDescription#appendValue%7D.%0A     *%0A     * @param item%0A     *         the item to describe%0A     *%0A     * @return a description of the item%0A     */
 %0A   

Document BestDescription