class MillisecondDurationNumberFormat extends TemplateNumberFormat {

        static final MillisecondDurationNumberFormat INSTANCE = new MillisecondDurationNumberFormat();

        @Override
        public String formatToPlainText(TemplateNumberModel templateNumberModel) throws TemplateModelException {
            Number n = templateNumberModel.getAsNumber();
            if (n == null) {
                return "None.";
            }
            long millis = n.longValue();
            if (millis == 0L) {
                return "0 ms.";
            }
            return processNonZeroMillis(millis);
        }

        private static String processNonZeroMillis(long millis) {<FILL_FUNCTION_BODY>}

        @Override
        public boolean isLocaleBound() {
            return true;
        }

        @Override
        public String getDescription() {
            return "Millisecond Duration";
        }
    }

            Duration duration = Duration.ofMillis(millis);
            long daysPart = duration.toDaysPart();
            long hoursPart = duration.toHoursPart();
            long minutesPart = duration.toMinutesPart();
            double seconds = duration.toSecondsPart() + (duration.toMillisPart() / 1000.0d);
            if (daysPart > 0) {
                return String.format("%02d:%02d:%02d:%06.3f s. (%,d ms.)",
                        daysPart,
                        hoursPart,
                        minutesPart,
                        seconds,
                        millis);
            } else if (hoursPart > 0) {
                return String.format("%02d:%02d:%06.3f s. (%,d ms.)",
                        hoursPart,
                        minutesPart,
                        seconds,
                        millis);
            } else if (minutesPart > 0) {
                return String.format("%02d:%06.3f s. (%,d ms.)",
                        minutesPart,
                        seconds,
                        millis);
            } else {
                return String.format("%.3f s. (%,d ms.)",
                        seconds,
                        millis);
            }
        
<no_super_class>