@Test public void customFormats() { HashMap<String, FormatFactory> registry = new HashMap<String, FormatFactory>(); registry.put("mask", MaskFormat.factory()); MessageFormat extformat = new MessageFormat( "hello {0, number}{1, mask, __ ____}xxx {2, date, ddmmyy} abc {3, mask, ___ ___}", registry); String out = extformat.render(100000, 313378, new Date(0), 313378); Assert.assertEquals(out, "hello 100,00031 3378xxx 010070 abc 313 378"); }
public Printer<?> getPrinter(MaskFormat annotation, Class<?> fieldType) { return new MaskFormatter(annotation.value()); }