1
2
3
4
5
6
7
8
9
10
11
12
13
14 package olg.csv.bean.loader.parser.impl;
15
16 import java.util.Locale;
17
18 import olg.csv.bean.loader.LoadException;
19 import olg.csv.bean.loader.Util;
20 import olg.csv.bean.loader.parser.AbstractParserLoader;
21 import olg.csv.bean.parser.AbstractParser;
22
23 import org.w3c.dom.Element;
24
25
26
27
28
29
30
31
32
33 public final class DateParserLoader extends AbstractParserLoader {
34
35
36
37
38
39
40 public DateParserLoader(AbstractParserLoader successor) {
41 super("date", successor);
42
43 }
44
45 @SuppressWarnings({"unchecked", "rawtypes"})
46 @Override
47 protected AbstractParser getConcreteParser(Class clazz, Element node) throws LoadException {
48 String loc = node.getAttribute("locale");
49 Locale locale = Util.getLocale(loc);
50
51 if (!"".equals(loc) && locale == null) {
52 throw new LoadException("Locale based on expression[" + loc + "] is not available ");
53 }
54 return AbstractParser.getDateParser(node.getAttribute("format"), clazz, locale);
55 }
56
57 }