コード例 #1
0
  @SuppressWarnings("unchecked")
  @Override
  public String print(Object object, Locale locale) {
    if (object == null) {
      return "";
    }

    // note: getClassWithoutInitializingProxy expects a non null object
    // _HACK_ as we depend on hibernate here.
    DiscoverablePrinter printer = printers.get(getClassWithoutInitializingProxy(object));
    return printer == null ? object.toString() : printer.print(object, locale);
  }
コード例 #2
0
 @Inject
 void buildCache(List<DiscoverablePrinter> registredPrinters) {
   for (DiscoverablePrinter printer : registredPrinters) {
     printers.put(printer.getTarget(), printer);
   }
 }