/** * Utility method to parse and then reformat a String. * * @param input String to reformat * @return A reformatted String * @throws ParseException thrown by parseObject(String) call */ public String reformat(final String input) throws ParseException { return format(parseObject(input)); }
@Test public void testUsage() throws Exception { final Format f1 = new SimpleDateFormat("MMddyyyy", Locale.ENGLISH); final Format f2 = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH); final CompositeFormat c = new CompositeFormat(f1, f2); final String testString = "January 3, 2005"; assertEquals(testString, c.format(c.parseObject("01032005"))); assertEquals(testString, c.reformat("01032005")); }
final CompositeFormat composite = new CompositeFormat(parser, formatter); composite.parseObject("", null); composite.format(new Object(), new StringBuffer(), null); assertEquals( "Parser get method incorrectly implemented", parser, composite.getParser() ); assertEquals( "Formatter get method incorrectly implemented", formatter, composite.getFormatter() );
/** * Utility method to parse and then reformat a String. * * @param input String to reformat * @return A reformatted String * @throws ParseException thrown by parseObject(String) call */ public String reformat(final String input) throws ParseException { return format(parseObject(input)); }
/** * Utility method to parse and then reformat a String. * * @param input String to reformat * @return A reformatted String * @throws ParseException thrown by parseObject(String) call */ public String reformat(final String input) throws ParseException { return format(parseObject(input)); }
/** * Utility method to parse and then reformat a String. * * @param input String to reformat * @return A reformatted String * @throws ParseException thrown by parseObject(String) call */ public String reformat(final String input) throws ParseException { return format(parseObject(input)); }