web/play-java-forms/src/main/java/play/data/format/Formatters.java
public <T> String print(TypeDescriptor desc, T t) {
    if (t == null) {
      return "";
    }
    if (desc != null && conversion.canConvert(desc, TypeDescriptor.valueOf(String.class))) {
      return (String) conversion.convert(t, desc, TypeDescriptor.valueOf(String.class));
    } else if (conversion.canConvert(t.getClass(), String.class)) {
      return conversion.convert(t, String.class);
    } else {
      return t.toString();
    }
  }
public <T> String print(TypeDescriptor desc, T t) {
    if (t == null) {
      return "";
    }
    if (desc != null && conversion.canConvert(desc, TypeDescriptor.valueOf(String.class))) {
      return (String) conversion.convert(t, desc, TypeDescriptor.valueOf(String.class));
    } else if (conversion.canConvert(t.getClass(), String.class)) {
      return conversion.convert(t, String.class);
    } else {
      return t.toString();
    }
  }
Computes the display string for any value, for a specific type.

@param desc the field descriptor - custom formatters are extracted from this descriptor.
@param t the value to print
@param <T> the type to print
@return the formatted string