MCPcopy Index your code
hub / github.com/antlr/codebuff / toString

Method toString

output/java8/1.4.14/DateRenderer.java:60–76  ·  view source on GitHub ↗
(Object o, String formatString, Locale locale)

Source from the content-addressed store, hash-verified

58 };
59
60 @Override
61 public String toString(Object o, String formatString, Locale locale) {
62 Date d;
63 if ( formatString==null ) formatString = "short";
64 if ( o instanceof Calendar ) d = ((Calendar)o).getTime();
65 else d = (Date)o;
66 Integer styleI = formatToInt.get(formatString);
67 DateFormat f;
68 if ( styleI==null ) f = new SimpleDateFormat(formatString, locale);
69 else {
70 int style = styleI.intValue();
71 if ( formatString.startsWith("date:") ) f = DateFormat.getDateInstance(style, locale);
72 else if ( formatString.startsWith("time:") ) f = DateFormat.getTimeInstance(style, locale);
73 else f = DateFormat.getDateTimeInstance(style, style, locale);
74 }
75 return f.format(d);
76 }
77}

Callers

nothing calls this directly

Calls 3

getMethod · 0.65
intValueMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected